sesinetd.install script and tar --wildcards

   3667   0   0
User Avatar
Member
387 posts
Joined: 7月 2005
Offline
Heya,

I just reviewed what's going on with tar and sesinetd.install (H8.1.934)

http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=6321&highlight=tar+wildcards [sidefx.com]
edward
I think you need to add –wildcards to the tar command line as noted on this thread:
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=6304 [sidefx.com]

My personal take on it is that the latest tar is broken and users should log bugs against it. Notice that there are no wildcards given in the first place in those scripts.

Heh. Good luck with lobbying GNU to change tar! Let me know how that goes.. I doubt any change will happen.

Nb: http://www.gnu.org/software/tar/manual/html_node/Changes.html [gnu.org]
GNU tar: an archiver tool

This manual is for GNU tar (version 1.16.1, 7 December 2006), which creates and extracts files from archives.

Appendix A Changes

This appendix lists some important user-visible changes between version GNU tar 1.16.1 and previous versions. An up-to-date version of this document is available at the GNU tar documentation page.

Use of globbing patterns when listing and extracting.
Previous versions of GNU tar assumed shell-style globbing when extracting from or listing an archive. For example:

$ tar xf foo.tar ‘*.c’

would extract all files whose names end in ?.c?. This behavior was not documented and was incompatible with traditional tar implementations. Therefore, starting from version 1.15.91, GNU tar no longer uses globbing by default. For example, the above invocation is now interpreted as a request to extract from the archive the file named *.c.

To facilitate transition to the new behavior for those users who got used to the previous incorrect one, tar will print a warning if it finds out that a requested member was not found in the archive and its name looks like a globbing pattern. For example:

$ tar xf foo.tar ‘*.c’
tar: Pattern matching characters used in file names. Please,
tar: use –wildcards to enable pattern matching, or –no-wildcards to
tar: suppress this warning.
tar: *.c: Not found in archive
tar: Error exit delayed from previous errors


To treat member names as globbing patterns, use ?wildcards option. If you want to tar to mimic the behavior of versions prior to 1.15.91, add this option to your TAR_OPTIONS variable.

See wildcards, for the detailed discussion of the use of globbing patterns by GNU tar.

Meantime, sesinetd.install is broken. It fails to install for tar version 1.16+

I think it might be more effective to embrace the change, and modify
the sesinetd.install script, which uses the wildcard character “*” at line 206
(eg. in houdini-8.1.934-linux_rhEL4.tar.gz). The line is:
gunzip -c $HERE/houdini.tar.gz | tar xf - “houdini/sbin/sesi*”

SESI - Here's a /bin/sh code snippet which would handle this situation:


#!/bin/sh
#
# An example script which decides whether to use the tar –wildcards option
#

#
# Put the gnu tar version numbers into a bash array
# We process a line which looks like this: tar (GNU tar) 1.16
#
declare -a tar_vers='( ‘`/bin/tar –version|head -1|awk ’{print $NF}'|sed -e ‘s/\./ /g’`' )'
tar_major_version=${tar_vers}
tar_minor_version=${tar_vers}


#
# Set the tar wildcards argument
#
if []; then
WILDCARDS_OPT=“”
else
echo tar will use the –wildcards option
WILDCARDS_OPT=“–wildcards”
fi

#
# call tar, assume $HERE is set
#
## /bin/tar zx $WILDCARDS_OPT -f $HERE/houdini.tar.gz ‘houdini/sbin/sesi*’
echo /bin/tar zx $WILDCARDS_OPT -f $HERE/houdini.tar.gz ‘houdini/sbin/sesi*’

The tar line assumes $HERE is set (it's set in sesinetd.install), and it uses
the ‘z’ option to ‘gunzip’ the archive. It only checks for versions <1.16,
a third subversion test (${tar_vers) could be added to improve the test.

cheers,
ben.

''You're always doing this: reducing it to science. Why can't it be real?'' – Jackie Tyler
  • Quick Links