Hi,
I'm just stumped by this one. It all started when I was trying to work
out a backup method of backing up all subdirs of /home/user as
individual tarballs. So I wanted to copy everything from the user's
top level directory to a temporary backup directory. This included
all hidden file, hidden directories, and plain files in /home/user.

Well, I did some testing as myself, and all seemed to be going well,
then I moved the script to /, and see what happens when root
ran it. Things went wrong, root runs the same file from /, and it
misses plain files like /home/user/sig.

I made a little test case to demonstrate the problem.
The following script is run by root in /home/user:
/home/zentara/backup-homex
---------------------------------------------------------------------------------------------------
#!/usr/bin/perl -w

@users=('/home/zentara');

#put all user-root hidden files and hidden dirs into 1 temp dir
#this makes it easier to backup second level subdirs
foreach $homedir(@users){
opendir DIR, $homedir or warn "Cannot readdir $homedir:$!\n";
@files = grep !/^\.\.?$/, readdir DIR;
foreach (@files){push @movem,$_ if -f}
foreach (@files){push @movem,$_ if ($_ =~ m!^[.]!)}
print "@movem\n";
print "##############################################\n";
}
exit;
----------------------------------------------------------------------------------------------------

When the above script is run as user or as root in /home/zentara
the output is good:

x z z1 zz sig sig1 sig2 sigs wxyz .Xmodmap sig.perl .bashrc .fvwm2rc
.bash_history backup-homex .Xdefaults .Xauthority .profile .Xresources
dontfeedtrolls .xinitrc wxyz-root .kc .le .mc .qt .ddd .kde .pan .pfm
.ssh .netscape .designer .babygimp .gftp .gimv .fvwm .java .kde2 .sane
.skel .ssh2 .vifm .wine .xmms .Xmodmap .tkalbum .bashrc .gnome2_private
.tkphone .dosemu .mozilla .gconfd .gnome2 .gphoto .gqview .glabels
.gkrellm .fvwm2rc .acrobat .gnucash .gimp-1.2 .pgaccess .regexp
.ptknotes .nautilus .bash_history .mhwaveedit .glameswap .autozen
.kalyptus .antiword .Xdefaults .gnome-desktop .Xauthority .profile
.jpi_cache .gnome_private .Xresources .xinitrc .pornview .adobe .cedit
.dillo .gconf .foxrc .gnome .gnupg .gtklp .links .tkfax .sweep
.cddbslave .roadmap .rolodex .sylpheed .TinyCA .emacs.d .wine.bak
##############################################

---------------------------------------------------------------------------------------------------------
when the above script is run by root from /, the output misses some
plain files, notably sig, but many are missing, seemingly random:

wxyz backup-homex .kc .le .mc .qt .ddd .kde .pan .pfm .ssh .netscape
.designer .babygimp .gftp .gimv .fvwm .java .kde2 .sane .skel .ssh2
.vifm .wine .xmms .Xmodmap .tkalbum .bashrc .gnome2_private .tkphone
.dosemu .mozilla .gconfd .gnome2 .gphoto .gqview .glabels .gkrellm
.fvwm2rc .acrobat .gnucash .gimp-1.2 .pgaccess .regexp .ptknotes
.nautilus .bash_history .mhwaveedit .glameswap .autozen .kalyptus
.antiword .Xdefaults .gnome-desktop .Xauthority .profile .jpi_cache
.gnome_private .Xresources .xinitrc .pornview .adobe .cedit .dillo
.gconf .foxrc .gnome .gnupg .gtklp .links .tkfax .sweep .cddbslave
.roadmap .rolodex .sylpheed .TinyCA .emacs.d .wine.bak
##############################################


Can someone shed some light on why this happens? It has
something to do with running it from /.

Thanks.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to