misc/102724: rc.initdiskless does not copy hidden files

Attila Nagy bra at fsn.hu
Thu Aug 31 11:40:30 UTC 2006

>Number:         102724
>Category:       misc
>Synopsis:       rc.initdiskless does not copy hidden files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 31 11:40:27 GMT 2006
>Originator:     Attila Nagy
>Release:        FreeBSD 6-STABLE
6.1-STABLE #5: Tue Aug 29 16:06:59 CEST 2006
In rc.initdiskless there is a loop, which iterates through the template directories and copies its content to the destination.

The command is
cp -Rp $j/* /$subdir
which obviously have problems with file names starting with a dot and maybe with other cases as well.

Leaving the * from the end, cp will copy all files, and due to -R, a source with an ending / means the contents of the directory will be copied, instead of the directory itself.

--- /etc/rc.initdiskless        Tue Aug 29 15:14:44 2006
+++ rc.initdiskless     Thu Aug 31 13:06:53 2006
@@ -300,7 +300,7 @@
        if [ -d $j -a ! -f $j.cpio.gz  ]; then
            create_md $subdir
-           cp -Rp $j/* /$subdir
+           cp -Rp $j/ /$subdir
     for j in /conf/$i/*.cpio.gz ; do


More information about the freebsd-bugs mailing list