Failing test "samba3.blackbox.give_owner.grant full rights(fileserver)"

Ralph Böhme slow at
Fri Oct 13 13:11:14 UTC 2017

...moving from samba-team to samba-technical...

On Thu, Oct 12, 2017 at 07:13:26PM +0000, Jeremy Allison wrote:
> RB+. I feel bad about the original tests, but they looked
> perfectly fine to me !

found it! Looks like you, me and every other team member whos username's first
character wasn't a valid escape sequence was lucky and autobuild kept working for

Everyone else like asn or vlendec not so much: /bin/sh on sn-devel-144 is dash
which has a XSI compliant echo builtin. That means echo will always interpret
escape sequences in strings, eg

$ /bin/sh -c 'echo -n "\a" | hexdump -C'
00000000  07                                                |.|

There's no way to prevent the echo command from doing this.

In the script echo was used to print an ACE which will
contain a DOMAIN\USER substring. If the first character of USER is a valid
escape sequence, the resulting string was interpreted as an escape sequence:

$ /bin/sh -c 'echo "FILESERVER\asn"'

The only portable way to print a string without interpreting embedded escape
sequences seems to be using printf:

$ /bin/sh -c 'printf "%s\n" "FILESERVER\asn"'

Attached patch fixes the problem. Please review & push if ok.

-------------- next part --------------
From a21f90b02ac421b42a8f884d81973cd43f2ca45f Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at>
Date: Fri, 13 Oct 2017 14:32:58 +0200
Subject: [PATCH] selftest: prevent interpretation of escape sequences in


Signed-off-by: Ralph Boehme <slow at>
 source3/script/tests/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/script/tests/ b/source3/script/tests/
index c8f437ebd8b..7ee37341b42 100755
--- a/source3/script/tests/
+++ b/source3/script/tests/
@@ -72,7 +72,7 @@ add_ace() {
     local fname=$2
     local ace=$3
-    local_ace=$(echo $ace | sed 's|\\|/|')
+    local_ace=$(printf '%s' "$ace" | sed 's|\\|/|')
     # avoid duplicate
     out=$($SMBCACLS //$SERVER/$share $fname -U $USERNAME%$PASSWORD)

More information about the samba-technical mailing list