Parsing os-release has incorrect quotes handling #77

Closed
opened 2023-01-25 10:58:30 +00:00 by blitz · 8 comments
blitz commented 2023-01-25 10:58:30 +00:00 (Migrated from github.com)

os-release has more syntax complexity than what we currently handle. Particularly entries with quotes in them will be handled the wrong way.

[os-release](https://www.freedesktop.org/software/systemd/man/os-release.html) has more syntax complexity than what we currently handle. Particularly entries with quotes in them will be handled the wrong way.
blitz commented 2023-02-02 13:32:47 +00:00 (Migrated from github.com)

I think it is better now, but still not quite there. We should check what systemd-stub does for reference. My issues are that we accept things that are forbidden by the "spec":

Shell special characters ("$", quotes, backslash, backtick) must be escaped with backslashes, following shell style.

I think it is better now, but still not quite there. We should check what systemd-stub does for reference. My issues are that we accept things that are forbidden by the "spec": `Shell special characters ("$", quotes, backslash, backtick) must be escaped with backslashes, following shell style.`
nikstur commented 2023-02-02 13:38:39 +00:00 (Migrated from github.com)

So you want to error out if the parser encounters a shell special character that is not escaped?

So you want to error out if the parser encounters a shell special character that is not escaped?
dasJ commented 2023-02-12 18:26:02 +00:00 (Migrated from github.com)

I actually think a lenient parser is more appreciated by the user while not introducing any (security) issues

I actually think a lenient parser is more appreciated by the user while not introducing any (security) issues
blitz commented 2023-02-14 22:58:09 +00:00 (Migrated from github.com)

We should try to emulate what systemd-stub does. In any case, we should document where we deviate from the "specification".

We should try to emulate what systemd-stub does. In any case, we should document where we deviate from the "specification".
AkechiShiro commented 2023-08-21 04:07:05 +00:00 (Migrated from github.com)

@blitz I'd like to help in this issue, a first step would be to take a look at systemd-stub's source code for parsing os-release ? And start writing WIP documentation ?

I think it is better now, but still not quite there. We should check what systemd-stub does for reference. My issues are that we accept things that are forbidden by the "spec":

By "spec", which spec are you referencing here ? Bootspec ?

@blitz I'd like to help in this issue, a first step would be to take a look at `systemd-stub`'s source code for parsing `os-release` ? And start writing WIP documentation ? > I think it is better now, but still not quite there. We should check what systemd-stub does for reference. My issues are that we accept things that are forbidden by the "spec": By "spec", which spec are you referencing here ? Bootspec ?
RaitoBezarius commented 2023-08-21 15:42:50 +00:00 (Migrated from github.com)

@blitz I'd like to help in this issue, a first step would be to take a look at systemd-stub's source code for parsing os-release ? And start writing WIP documentation ?

I would argue that it would be better to implement the format properly while referring to the upstream documentation.
Redoing documentation will just get us documentation that will bitrot.

I think it is better now, but still not quite there. We should check what systemd-stub does for reference. My issues are that we accept things that are forbidden by the "spec":

By "spec", which spec are you referencing here ? Bootspec ?

The specification for os-release scheme.

> @blitz I'd like to help in this issue, a first step would be to take a look at `systemd-stub`'s source code for parsing `os-release` ? And start writing WIP documentation ? I would argue that it would be better to implement the format properly while referring to the upstream documentation. Redoing documentation will just get us documentation that will bitrot. > > I think it is better now, but still not quite there. We should check what systemd-stub does for reference. My issues are that we accept things that are forbidden by the "spec": > > By "spec", which spec are you referencing here ? Bootspec ? The specification for os-release scheme.
RaitoBezarius commented 2023-10-25 13:23:43 +00:00 (Migrated from github.com)

I spoke a bit with systemd upstream, the true "spec" is the code and until there's some stuff to automate sync between "spec" (manpage) and code (true spec), there should be no expectation we have specification.

In practice, the spirit of os-release is subset of Bourne shell without interpolation or variable assignment. As long as we are not too far from this, I would not prioritize this.

I spoke a bit with systemd upstream, the true "spec" is the code and until there's some stuff to automate sync between "spec" (manpage) and code (true spec), there should be no expectation we have specification. In practice, the spirit of os-release is subset of Bourne shell without interpolation or variable assignment. As long as we are not too far from this, I would not prioritize this.
AkechiShiro commented 2023-10-27 00:39:43 +00:00 (Migrated from github.com)

Thanks for the update, is there any issue tracking an effort of having a better spec as a whole (i.e. issue tracking work on manpage "spec" that is trying to become closer and closer/more compliant with code "spec" in upstream systemd) to this day, so that, we could know when we could start prioritizing this work ?

Thanks for the update, is there any issue tracking an effort of having a better spec as a whole (i.e. issue tracking work on manpage "spec" that is trying to become closer and closer/more compliant with code "spec" in upstream systemd) to this day, so that, we could know when we could start prioritizing this work ?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: raito/lanzaboote#77
No description provided.