Bug 8924 - Avoid bashism in smbtar
Avoid bashism in smbtar
Status: RESOLVED INVALID
Product: Samba 3.6
Classification: Unclassified
Component: Client Tools
3.6.5
All All
: P5 normal
: ---
Assigned To: Volker Lendecke
Samba QA Contact
http://bugs.debian.org/486056
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-09 13:35 UTC by Debian samba package maintainers (PUBLIC MAILING LIST)
Modified: 2012-06-10 11:52 UTC (History)
0 users

See Also:


Attachments
Drop bashism in smbtar (711 bytes, patch)
2012-05-09 13:35 UTC, Debian samba package maintainers (PUBLIC MAILING LIST)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Debian samba package maintainers (PUBLIC MAILING LIST) 2012-05-09 13:35:53 UTC
Created attachment 7540 [details]
Drop bashism in smbtar

We have this patch for quite some time in Debian and it probably deserves to be included upstream even if this is a very low-hanging fruit..:-)
Comment 1 Björn Jacke 2012-06-10 00:15:20 UTC
the proposed printf doesn't work with NetBSD's "ash", so this doesn't make it more portable here.

On the other hand I can't think of a shell which would not print a "\" when echo "\\" is being done. I don't see where this might be unportable shell code. Maybe the bashism checker is a bit overzealous. Until you show us a shell where this code fails, we should treat this as correct I think.
Comment 2 Luk Claes 2012-06-10 06:48:26 UTC
> the proposed printf doesn't work with NetBSD's "ash", so this doesn't make it
> more portable here.

Hmm, why does NetBSD not use a POSIX compliant shell?

> On the other hand I can't think of a shell which would not print a "\" when
> echo "\\" is being done. I don't see where this might be unportable shell code.
> Maybe the bashism checker is a bit overzealous. Until you show us a shell where
> this code fails, we should treat this as correct I think.

In practice when using "\\" shells that don't support it, will probably
use the echo command which handles it without problems. According to
POSIX it's not guaranteed to work though, while printf should.
Comment 3 Björn Jacke 2012-06-10 11:52:49 UTC
(In reply to comment #2)
> > the proposed printf doesn't work with NetBSD's "ash", so this doesn't make it
> > more portable here.
> 
> Hmm, why does NetBSD not use a POSIX compliant shell?

ash isn't the default shell there. You also have ash on other platforms optionally.


> In practice when using "\\" shells that don't support it, will probably
> use the echo command which handles it without problems. According to
> POSIX it's not guaranteed to work though, while printf should.

do you have a pointer to where posix sais that?