[lfs-support] No Pattern Matching Using $foo in Chroot Environment

Dan McGhee beesnees at grm.net
Fri Oct 18 08:08:12 PDT 2013

I'm trying to run a script to build a package--I use the package users 
hint--which has the following:
package=$(whoami) #In this case I'm man-pages-3.5.3

Later when I want to define a variable containing the name of the 
directory into which tar will extract the archive, I have
<pkgsrcdir=$(tar -tf $archive | grep / | head -n 1 | cut -d '/' -f 1)>

The script bails out at this point complaining that there's no file or 
directory by that name.  Running <sh -x script_name reveals "archive = 
""" (BTW sh reports that $packagedir and $package are properly defined.)

I have discovered that when I use {ls /sources/$(whoami) or $<anything 
that gives "man-pages-3.5.3">.tar*} as a package user, the return is 
<"man-pages-3.5.3*": No such file or directory.>  /sources is world 
readable and writable.

If, however, I issue <ls /sources/man-pages*> the return is 

The pattern matching is fine for root:
ls /sources/$foo.tar.*

gives the right answer.

I've never encountered this before.  My hunch is that it's some 
environment variable.  I know that pattern matching involves globbing 
and clobbering, but I don't know enough--and can't find the info--to 
even experiment.

In the past, something like this usually leads to, "I can't see the 
forest because there are so many trees in the way."  I don't know if I'm 
really focusing on those trees or not.

In the meantime, I'm going to go through the bash man page.  I will be 
grateful for any pointers or suggestions.


More information about the lfs-support mailing list