[Gloucs] tar + hidden characters?
Guy Edwards
gloucs at mailman.lug.org.uk
Mon Sep 1 01:12:01 2003
I could do with a sanity check... I'm trying to read a list of files into tar using its T option.
There's some hidden characters being produced in the files though, if anyone knows an explanation I'm all ears.
bear with me on this one.....
1) A file exists with a list of files in it. I've shortened it to one file in this example
(~/DWG)> cat filelist
000-143.dwg
The file it mentions exists
(~/DWG)> ls -l 000-143.dwg
-rwxr-xr-x 1 hairball hairball 104997 Aug 31 00:58 000-143.dwg*
but this command fails
(~/DWG)> tar -cv -T filelist -f backup.tar
tar: 000-143.dwg : Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
2) If I create the file by hand it works file
(~/DWG)> echo "000-143.dwg" > filelist
(~/DWG)> echo "000-216a.dwg" >> filelist
(~/DWG)> tar -cv -T filelist -f backup.tar
000-143.dwg
000-216a.dwg
3) If I create the file with this script it doesn't work
grep -i "Return status 1" ../report.txt | sed -e 's/Return status 1//' -e 's/[/]home[/]hairball[/]DWG[/]//' > filelist
tar -cf error_drawings.tar -T filelist
basically the script takes this:
/home/hairball/DWG/11X7_16_BAR.dwg Return status 0
/home/hairball/DWG/11X7_8_BAR.dwg Return status 0
/home/hairball/DWG/11X9_16_BAR.dwg Return status 0
/home/hairball/DWG/11zkit01.dwg Return status 1
and outputs this (I'm testing software):
11zkit01.dwg
(~/DWG)> tar -cv -T filelist -f backup.tar
tar: 000-143.dwg : Cannot stat: No such file or directory
tar: 000-216a.dwg : Cannot stat: No such file or directory
4) Now looking at the two outputed "filelist" files with cat they appear
identical (1 echoed by hand, 1 from a script). but if I use "od" to do
a dump of the files, there's obviously something going on as they aren't
the same:
(unworking)
(~/DWG)> od filelist
0000000 030060 026460 032061 027063 073544 020147 030012 030060 <-- diff
0000020 031055 033061 027141 073544 020147 000012 <-- diff
0000033 <-- diff
(working)
(~/DWG)> od filelist.1
0000000 030060 026460 032061 027063 073544 005147 030060 026460
0000020 030462 060466 062056 063567 000012
0000031
(~/DWG)> cat filelist
000-143.dwg
000-216a.dwg
(~/DWG)> cat filelist.1
000-143.dwg
000-216a.dwg
Anyone any ideas what I've done to break it?
Guy