-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minor bug in awk statement in zpool_id script. #259
Comments
I got another link, aparently it's an awk vs. awk issue with ubuntu dependancies. the following alternate may be better: ID_ZPOOL=$( grep -w ${ID_PATH} ${CONFIG} | sed -e "s/\s${ID_PATH}//" ) it doesn't depend on awk and all linuces include grep and sed standard. |
and a minor update, -w doesn't work like it's supposed to, but this does: ID_ZPOOL=$( grep "\s${ID_PATH}$" ${CONFIG} | sed -e "s/\s${ID_PATH}//" ) fully tested with duplicate lines and working. |
The \s character class seems to be a PCRE extension in GNU sed. (See the sed/testsuite/PCRE.tests file.) I tried this in a busybox rescue environment, but the expression was unrecognized. A conservative [ ]+ is more likely to be reliable on all systems. |
I remember hitting this once before, at the time it looked to me like an issue with mawk which is the default awk on Ubuntu. When I installed gawk it was able to match the pattern correctly. I'm all for doing something more portable if possible but the regex rule may be a little tricker that it first appears. It must do the following:
|
On 5/31/2011 09:31, behlendorf wrote:
Perhaps we should use it as a shell file instead? I'm not sure if |
On 5/31/2011 08:10, dajhorn wrote:
|
This bit me (again) today on a new machine with Ubuntu 11.10. It would be great to have this fixed. Maybe as a workaround until a portable solution is found you could add gawk as a dependency to the ppa? |
@ulope: Can you post a I will try fixing the bug generally before adding a dependency to the PPA. |
Some implementations of `awk` incorrectly parse the \< and \> regex symbols, so use a `while read` loop and regular globbing instead. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes: #259
@behlendorf or @aarcane: You can close this milestone issue. It looks like Github doesn't automatically act on the commit "Closes:" line if it comes after an attribution line. |
Some implementations of `awk` incorrectly parse the \< and \> regex symbols, so use a `while read` loop and regular globbing instead. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes: openzfs#259
…#259) Signed-off-by: nsathyaseelan <sathyaseelan.n@mayadata.io>
Signed-off-by: Andrew Innes <andrew.c12@gmail.com>
Signed-off-by: Andrew Innes <andrew.c12@gmail.com>
https://github.com/behlendorf/zfs/blob/master/cmd/zpool_id/zpool_id#L52 the < and > in the awk line result in an inability to parse the zdev.conf file unless the path id is wrapped in < and > like a1 pci-0000:00:1f.2-scsi-0:0:0:0 .
The text was updated successfully, but these errors were encountered: