Ticket #3379 (closed defect: fixed)
bashism in /bin/sh script
Reported by: | onlyjob | Owned by: | zaytsev |
---|---|---|---|
Priority: | minor | Milestone: | 4.8.16 |
Component: | mc-vfs | Version: | 4.8.15 |
Keywords: | bashism | Cc: | |
Blocked By: | Blocking: | ||
Branch state: | no branch | Votes for changeset: |
Description
As reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772306
Bashism were found in the src/vfs/extfs/helpers/gitfs+ file:
26: echo -e "$2" > "$4"
Therefore correct functioning of this script is not guaranteed under "/bin/sh".
"echo -e" should be replaced with "printf", see more:
Change History
comment:2 follow-up: ↓ 3 Changed 10 years ago by ossi
you just committed "printf usage FAILs 101".
printf "%s\n" "$2" > "$4"
comment:3 in reply to: ↑ 2 Changed 10 years ago by egmont
Replying to ossi:
you just committed "printf usage FAILs 101".
So did the original echo command :) in fact, every echo command whose first parameter is untrusted. Both bash's and coreutils's echo recognize certain flags but not "--".
printf %s is indeed the right way to go.
comment:4 Changed 9 years ago by zaytsev
- Owner set to zaytsev
- Status changed from new to accepted
- Version changed from 4.8.13 to 4.8.15
- Milestone changed from Future Releases to 4.8.16
Committed as fb9caaa6718c8553aeaf46a77ca5be7ac164a077 in 3547_cleanup.
comment:7 Changed 9 years ago by andrew_b
- Status changed from accepted to testing
- Resolution set to fixed
Applied as [391821e4ab37ac4f16b93525d8837c9feb088f2f].
Something like this can fix it:
Alternatively "/bin/echo -e" can be used instead of "echo -e".