Gentoo Archives: gentoo-user

From: tuxic@××××××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] detox'ing files by keeping their time stamp?
Date: Sun, 18 Feb 2018 13:44:46
Message-Id: 20180218134424.pg52kyrmdnd3zzfe@solfire
In Reply to: Re: [gentoo-user] detox'ing files by keeping their time stamp? by Floyd Anderson
1 On 02/18 01:55, Floyd Anderson wrote:
2 > On Sun, 18 Feb 2018 13:07:33 +0100
3 > tuxic@××××××.de wrote:
4 > > On 02/18 11:38, Stroller wrote:
5 > > >
6 > > > > On 18 Feb 2018, at 08:21, tuxic@××××××.de wrote:
7 > > > >
8 > > > > when downloading files from non-UNIX sites, they often contain
9 > > > > "poisonoys" characters like '#', ' ', ''' or that alike.
10 > > > >
11 > > > > With the tool 'detox' those filenames could be fixed.
12 > > > >
13 > > > > But detox changes the time stamp of the files, which
14 > > > > filenames are altered (not all files, which are examined).
15 > > > >
16 > > > > Is there a way to either get detox not to alter the time stamp
17 > > >
18 > > > I think:
19 > > >
20 > > > tmpfile=/tmp/foo-$RANDOM
21 > > > touch -r "$file" "$tmpfile"
22 > > > detox "$file"
23 > > > touch -r "$tmpfile "$file"
24 > > > rm "$tmpfile"
25 > > >
26 > > > It should be trivial to patch detox to do this itself.
27 > > >
28 > > > Stroller
29 > > >
30 > > >
31 > > >
32 > >
33 > > Hi Stroller,
34 > >
35 > > this seems to be an egg<->chicken problem.
36 > >
37 > > I like to wrap detox with a script, which will do you magic trick.
38 > > Since I want to get rid of those evil characters (...) in the filename,
39 > > which normally intercept shell processing, I want to use detox,
40 > > which in turn will be called by a shell script in turn, to do the
41 > > time machine magic. To do so, I need detox, to sanitize the
42 > > filenames from the evil characters, which normally intercept.....
43 > > .....stack overflow....recursion depth failure.....process killed.
44 > >
45 > > You know....
46 > >
47 > > I am using zsh...
48 > >
49 > > Any idea to get a chicken OR an egg instead of an scrambled egg with
50 > > feathers??? ;)
51 >
52 > Go back one step and reread the manual page. It seems to be there is an
53 > option ‘--dry-run’ (implies ‘--verbose’) that can probably be used to store
54 > a list of the final new file names. Afterwards you can traverse this list
55 > with Stroller’s suggestion (slightly adopted of course).
56 >
57 > Or you can try other tools which doesn’t use function rename() [1], e.g.
58 > perl-rename, and therefore don’t change the last modification time.
59 >
60 > Or you can go two steps back and save the file(s) to your like when you
61 > download it, e.g. with curl (maybe your’re also interested in its
62 > ‘--remote-time’ option).
63 >
64 >
65 > References:
66 > - [1] <http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html>
67 >
68 >
69 > --
70 > Regards,
71 > floyd
72 >
73 >
74
75 Hi Floyd,
76
77 the unrenamed files are the only ones with the correct timestamp.
78 Therefore 'touch' has to access them.
79 But their filenames contain the poisonous characters.
80 And the circle starts right from the beginning.
81 The problem arises at that moment, where I need to feed the name
82 of a single file what program ever, since first there is the shell...
83 even when calling other programs.
84
85 Cheers
86 Meino

Replies

Subject Author
Re: [gentoo-user] detox'ing files by keeping their time stamp? Floyd Anderson <f.a@××××.net>