Bug 1056527 - Augeas lens bug: shellvars and case statements with same-line ;; tokens
Summary: Augeas lens bug: shellvars and case statements with same-line ;; tokens
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: augeas
Version: 20
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Dominic Cleal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1033799
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-22 11:34 UTC by Filip Krska
Modified: 2017-06-12 15:37 UTC (History)
7 users (show)

Fixed In Version: augeas-1.3.0-1.fc21
Clone Of: 1033799
Environment:
Last Closed: 2015-01-05 09:19:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
support for oneliners in case (3.47 KB, patch)
2014-01-29 12:46 UTC, Filip Krska
lutter: review+
Details | Diff

Comment 1 Filip Krska 2014-01-22 16:08:55 UTC
It seems, that the problem is the 'entry*' field which is supposed to be in between "choice)" and ";;" in case_entry defined in
/usr/share/augeas/lenses/dist/shellvars.aug

All types of entries are terminated with "comment_or_eol" which is comment "\n" or ";" unlike shell's "list" which it is probably aimed to interpret. List according to `man bash` is _optionally_ terminated by one of ;, &, or <newline>.

In order to support broader subset of valid "case" styles kind of "_noeol" variants of entries should be introduced (there's no ; or "\n" required before ";;"), I see no one-liner fix here.

What I see as another problem is incomplete documentation (http://augeas.net/docs/references/lenses/files/shellvars-aug.html states TBD). It's obvious from shellvars.aug, that the Shellvars lens does support relatively small subset of shell syntax (e.g. only "ulimit" | "shift" | "exit" builtins and no arbitrary commands, so usage of e.g. "echo" breaks the load) so documentation should exist and specify what is supported and set expectations properly.

Comment 2 Filip Krska 2014-01-29 12:46:45 UTC
Created attachment 857046 [details]
support for oneliners in case

Proposing patch adding support for (reasonable subset of) oneliners in case entries.

However, I treat this rather as a quick non-invasive dirty fix of this particular hot use case than a final fix.

IMHO all entries should be defined according to shell's "list" philosophy i.e. not ending with comment_or_eol and occurrences of entry* should be replaced with something like `(entry . comment_or_eol)*` where ; or eol is mandatory and `(entry . comment_or_eol)* . entry?` where optional.

Comment 3 Dominic Cleal 2014-02-12 12:37:30 UTC
Fixed in a1b9831d14f22f81cf7dc840160c08cc14234ee9 upstream.

Comment 4 Dominic Cleal 2015-01-05 09:19:23 UTC
Fixed in Fedora 21 and rawhide, via Augeas 1.3.0.


Note You need to log in before you can comment on or make changes to this bug.