bin/60524: mtree tumbles on files begining with hashmark(#)
Hiroharu Tamaru
tamaru at myn.rcast.u-tokyo.ac.jp
Tue Dec 23 00:20:15 PST 2003
>Number: 60524
>Category: bin
>Synopsis: mtree tumbles on files begining with hashmark(#)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Dec 23 00:20:10 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Hiroharu Tamaru
>Release: FreeBSD 4.9-STABLE i386
>Organization:
The University of Tokyo
>Environment:
System: FreeBSD gin 4.9-STABLE FreeBSD 4.9-STABLE #0: Fri Nov 28 15:13:39 JST 2003 MYN-P6 i386
>Description:
mtree fails to handle filenames that begin with hashmark(#).
It writes the mtree file fine in -c mode, but skips the line
as a comment line in check mode and thus gives false alarm.
>How-To-Repeat:
echo a > #a
echo b > a
echo c > a#
echo d > '\a'
echo e > 'a\'
echo f > '\#a'
echo g > b
ls -l
total 7
-rw-r--r-- 1 tamaru wheel 2 Dec 23 16:55 #a
-rw-r--r-- 1 tamaru wheel 2 Dec 23 16:55 \#a
-rw-r--r-- 1 tamaru wheel 2 Dec 23 16:55 \a
-rw-r--r-- 1 tamaru wheel 2 Dec 23 16:55 a
-rw-r--r-- 1 tamaru wheel 2 Dec 23 16:55 a#
-rw-r--r-- 1 tamaru wheel 2 Dec 23 16:55 a\
-rw-r--r-- 1 tamaru wheel 2 Dec 23 16:55 b
mtree -c -K md5digest > /tmp/test.mtree
mtree < /tmp/test.mtree
. changed
MD5 expected 60b725f10c9c85c70d97880dfe8191b3 found 1335b892002f8dcf803\
e474f33efdb11
#a extra
cat /tmp/test.mtree
(snip)
# .
/set type=file uid=0 gid=0 mode=0644 nlink=1 flags=none
. type=dir uid=10001 mode=0755 nlink=2 size=512 \
time=1072166150.0
#a uid=10001 size=2 time=1072166144.0 \
md5digest=60b725f10c9c85c70d97880dfe8191b3
\\#a uid=10001 size=2 time=1072166144.0 \
md5digest=9a8ad92c50cae39aa2c5604fd0ab6d8c
\\a uid=10001 size=2 time=1072166144.0 \
md5digest=e29311f6f1bf1af907f9ef9f44b8328b
a uid=10001 size=2 time=1072166144.0 \
md5digest=3b5d5c3712955042212316173ccf37be
a# uid=10001 size=2 time=1072166144.0 \
md5digest=2cd6ee2c70b0bde53fbe6cac3c8b8bb1
a\\ uid=10001 size=2 time=1072166144.0 \
md5digest=9ffbf43126e33be52cd2bf7e01d627f9
b uid=10001 size=2 time=1072166144.0 \
md5digest=f5302386464f953ed581edac03556e55
..
>Fix:
Since backslashes are escaped correctly, I suggest that a leading hashmark
be escaped as '\#'.
Adding a backslash before # by hand in a mtree file does not solve the
problem, so I assume that both writeing and reading routines should be
updated.
Curretly, as I see it, a file named '\#a' is written in mtree file as
'\\#a', but an mtree file that reads '\#a' is also interpreted as filename
'\#a', which may or may not be a real compatibility issue.
I haven't dug into the source to come up with a patch, sorry.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list