Hello Bart, On Sunday 15 June 2008, Bart Samwel wrote: > Hi Raphael, > > Raphael Geissert wrote: > > notfixed 480606 1.42-1 > > thanks > > > > in laptop-mode-tools_1.42-1_all.deb: > >> possible bashism in ./usr/sbin/lm-profiler line 136 (unsafe echo with > >> backslash): > >> echo -n "\r > >> \rWrite accesses at $1/$PROFILE_RUN_LENGTH in > >> lm-profiler run:" > >> possible bashism in ./usr/sbin/lm-profiler line 148 > (unsafe echo with > >> backslash): > >> echo -n "\r > >> \rRead accesses at > >> $1/$PROFILE_RUN_LENGTH in lm-profiler run:" > >> possible bashism in > >> ./usr/sbin/lm-profiler line 205 (unsafe echo with backslash): > >> echo -n > >> "\r$SECONDS_DONE seconds elapsed, $(($PROFILE_RUN_LENGTH - > >> $SECONDS_DONE)) remaining. \b\b\b\b\b\b\b\b\b" > >> possible bashism in > >> ./usr/sbin/lm-profiler line 210 (unsafe echo with backslash): > >> echo -n "\r > > This is with checkbashisms -n.
Nope. > According to the checkbashisms manual and > according to the Debian Policy Manual section 10.4, echo -n should be > supported. Therefore, this is not a bug. Right? echo -n must be supported by a suitable 'sh' replacement, i.e. dash. But here's the reason of the report (taking one of the lines as an example): $ cat /tmp/foo PROFILE_RUN_LENGTH=100 SECONDS_DONE=50 echo -n "\r$SECONDS_DONE seconds elapsed, $(($PROFILE_RUN_LENGTH - $SECONDS_DONE)) remaining. \b\b\b\b\b\b\b\b\b" $ dash /tmp/foo; echo 50 seconds elapsed, 50 remaining. $ bash /tmp/foo; echo \r50 seconds elapsed, 50 remaining. \b\b\b\b\b\b\b\b\b $ posh /tmp/foo; echo 50 seconds elapsed, 50 remaining. $ zsh /tmp/foo; echo 50 seconds elapsed, 50 remaining. $ pdksh /tmp/foo; echo 50 seconds elapsed, 50 remaining. $ ksh /tmp/foo; echo \r50 seconds elapsed, 50 remaining. \b\b\b\b\b\b\b\b\b $ mksh /tmp/foo; echo 50 seconds elapsed, 50 remaining. Hope you see what I mean. Although this bug isn't really dash-specific, it usually is when the expected behaviour of echo is to interpret backslashes. The right way to do this is with printf. E.g. printf '\r%d seconds elapsed, %d remaining. \b\b\b\b\b\b\b\b\b' "$SECONDS_DONE" "$(($PROFILE_RUN_LENGTH - $SECONDS_DONE))" > > Cheers, > Bart Cheers, -- Atomo64 - Raphael Please avoid sending me Word, PowerPoint or Excel attachments. See http://www.gnu.org/philosophy/no-word-attachments.html
signature.asc
Description: This is a digitally signed message part.