l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
August 5: Social gathering
Next Installfest:
TBD
Latest News:
Jul. 4: July, August and September: Security, Photography and Programming for Kids
Page last updated:
2011 Jan 18 21:48

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Ubuntu 10.04 LTS upgrade woes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Ubuntu 10.04 LTS upgrade woes



On Tue, 2011-01-18 at 18:07 -0800, Bill Broadley wrote:
> On 01/18/2011 03:43 PM, Brian Lavender wrote:
> > tar cf dotfiles.tar .[!.]* || exit 2
> 
> I agreed with most of Brian's post, but the above seems unnecessarily complex 
> and useless.  My best guess is that someone is paranoid, doesn't understand 
> that ".." is a special case, or maybe it's portable to some broken version of 
> tar like solaris's.
> 
> To demonstrate:
> bill@kona:~/tmp/t2$ tar cvzf ../t1.tar .[!.]*
> .bar
> .blarg
> .foo
> .zoop/
> bill@kona:~/tmp/t2$ tar cvzf ../t2.tar .
> ./
> ./.foo
> ./.bar
> ./.blarg
> ./.zoop/
> bill@kona:~/tmp/t2$
> 
> No protecting against ".." necessary.  Nor would ~/..foo be accidentally
> excluded (unlikely but legal).  Nor am I sure what || exit 2 is supposed to 
> do.  Well I know about return values... but why?
> 
> Does anyone know of a Linux tar that doesn't behave like the above?

I think you're misreading his intent.

He wants *only* the dotfiles (and none of the regular files), so what he
wants is 

    tar zcf dotfiles.tar .*

However, when you ask for .*, the expansion includes . so your entire
home directory is tarred up in the tarball. He should change it to 

    tar zcf dotfiles.tar .?*

which will require at least an additional character. But when you do
this, .. is included in the glob expansion, and so .. and all its
children get included in the tarball. (Yes, I tested on GNU tar)

That's why he changed it to the following, which requires there be a
non-dot character after the dot

    tar zcfv dotfiles.tar .[!.]*

_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.