Subject: bin/31922: mtree -C/-D special character handling broken
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Thomas Klausner <wiz@NetBSD.org>
List: netbsd-bugs
Date: 10/26/2005 17:35:01
>Number:         31922
>Category:       bin
>Synopsis:       mtree -C/-D special character handling broken
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 26 17:35:00 +0000 2005
>Originator:     Thomas Klausner
>Release:        NetBSD 3.99.10/20051015
>Organization:

>Environment:
	
	
Architecture: i386
Machine: i386
>Description:
mtree -C and mtree -D print incorrect file names in some cases:
$ mkdir a
$ cd a
$ mkdir b
$ touch b/space\ here
$ touch b/space\\shere
$ mtree  -c
#          user: wiz
#       machine: foo
#          tree: /home/wiz/a
#          date: Wed Oct 26 19:30:26 2005

# .
/set type=file uid=100 gid=0 mode=0755 nlink=1 flags=none
.               type=dir nlink=3 time=1130347821.354172000

# ./b
/set type=file uid=100 gid=0 mode=0644 nlink=1 flags=none
b               type=dir mode=0755 nlink=2 time=1130347823.489604000
    space\shere size=0 time=1130347821.363493000
    space\\shere \
                size=0 time=1130347823.478193000
# ./b
..

$ ../a.mtree
$ mtree -f ../a.mtree -C
. type=dir uid=100 gid=0 mode=0755 nlink=3 time=1130347821.354172000 flags=none
./b type=dir uid=100 gid=0 mode=0755 nlink=2 time=1130347823.489604000 flags=none
./b/space\shere type=file uid=100 gid=0 mode=0644 nlink=1 size=0 time=1130347821.363493000 flags=none
./b/space\shere type=file uid=100 gid=0 mode=0644 nlink=1 size=0 time=1130347823.478193000 flags=none
$ mtree -f ../a.mtree -D
type=dir uid=100 gid=0 mode=0755 nlink=3 time=1130347821.354172000 flags=none .
type=dir uid=100 gid=0 mode=0755 nlink=2 time=1130347823.489604000 flags=none ./b
type=file uid=100 gid=0 mode=0644 nlink=1 size=0 time=1130347821.363493000 flags=none ./b/space\shere
type=file uid=100 gid=0 mode=0644 nlink=1 size=0 time=1130347823.478193000 flags=none ./b/space\shere
$

Note that the '\s' now denotes both space characters and '\s'.
>How-To-Repeat:
See above.
>Fix:
Not provided. mtree should just copy the file name instead of parsing it.

>Unformatted: