All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: GitHub issues - opened <github@alsa-project.org>
To: alsa-devel@alsa-project.org
Subject: [Bug] Duplication in Array Element not Handled in Parsing conf
Date: Thu, 10 Jun 2021 07:06:52 +0200 (CEST)	[thread overview]
Message-ID: <20210610050652.B8400F80218@alsa1.perex.cz> (raw)
In-Reply-To: <1623301608142592907-webhooks-bot@alsa-project.org>

alsa-project/alsa-lib issue #151 was opened from aiChaoSONG:

When parsing array element in conf files, an auto-increase number is used as config id(`snd_config_t->id`), and array element as the config value(`snd_config_t->u.string/integer/integer64/real`), duplication is not handle in `parse_array_defs/parse_array_def/parse_value` functions.

Suppose we have a conf:
```
array [
    "a"
    "b"
    "a"
]
```
the parsed result will be:
```
    parent
        |
        ---- snd_config_t {id: "0", u.string: "a"}
        |
        ---- snd_config_t {id: "1", u.string: "b"}
        |
        ---- snd_config_t {id: "2", u.string: "a"}
```
The duplication in "a" may be desired. But please consider this condition: suppose we have four conf files A, B, C and D, where A 
is the conf above, let B include A, C include A, D include B and C, so D include A twice indirectly. File A will be processed twice when parsing D, because duplication is not handled, here comes the problem, the parsed result of A in D is:
```
    parent
        |
        ---- snd_config_t {id: "0", u.string: "a"}
        |
        ---- snd_config_t {id: "1", u.string: "b"}
        |
        ---- snd_config_t {id: "2", u.string: "a"}
        |
        ---- snd_config_t {id: "3", u.string: "a"}
        |
        ---- snd_config_t {id: "4", u.string: "b"}
        |
        ---- snd_config_t {id: "5", u.string: "a"}
```
This is obviously wrong.

I think handle duplication in parse_value is not the solution, because element duplication in an array is wanted. The key problem here is that we parse the same conf more than once.

Issue URL     : https://github.com/alsa-project/alsa-lib/issues/151
Repository URL: https://github.com/alsa-project/alsa-lib

           reply	other threads:[~2021-06-10  5:07 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1623301608142592907-webhooks-bot@alsa-project.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210610050652.B8400F80218@alsa1.perex.cz \
    --to=github@alsa-project.org \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.