lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070313044555.GO943@1wt.eu>
Date:	Tue, 13 Mar 2007 05:45:56 +0100
From:	Willy Tarreau <w@....eu>
To:	Gene Heskett <gene.heskett@...il.com>
Cc:	linux-kernel@...r.kernel.org,
	Nish Aravamudan <nish.aravamudan@...il.com>,
	Douglas McNaught <doug@...aught.org>,
	Patrick Mau <mau@...ar.ping.de>
Subject: Re: Stracing Amanda (was: RSDL for 2.6.21-rc3- 0.29)

On Tue, Mar 13, 2007 at 12:04:42AM -0400, Gene Heskett wrote:
> On Monday 12 March 2007, Nish Aravamudan wrote:
> >On 3/12/07, Gene Heskett <gene.heskett@...il.com> wrote:
> >> On Monday 12 March 2007, Douglas McNaught wrote:
> >> >Patrick Mau <mau@...ar.ping.de> writes:
> >> >> Why not temporarly replace "/bin/tar" with a shell script that
> >> >> does:
> >> >>
> >> >> #!/bin/sh
> >> >> exec strace -f -o output /bin/real.tar $@
> >> >
> >> >You beat me to it.  :) I've done that before; it's a great
> >> > suggestion.
> >> >
> >> >Except that if you expect 'tar' to be invoked multiple times in a
> >> > run, you should probably use 'output.$$' for the output filename so
> >> > things don't get clobbered.
> >> >
> >> >-Doug
> >>
> >> In my case, Doug, it will get invoked 64 times, amanda does a dummy
> >> run to get an estimate, calculates what to do based on that output
> >> which is 32 runs, 1 per disklist entry and I have 32, and then reruns
> >> tar with the appropriate level options against each individual
> >> disklist entry.
> >>
> >> But I'm puzzled a bit, what does the double $$ do?, or it buried
> >> someplace in the bash manpage?  Its not something I've stumbled over
> >> yet.
> >
> >buried indeed:
> >
> >"Special Parameters:
> >  ...
> >       $      Expands to the process ID of the shell.  In a  () 
> > subshell,  it expands  to  the  process  ID of the current shell, not
> > the sub?$B!> shell.
> >"
> 
> Well, that's clear enough, but what of the double $$ case?  Would this 
> them make a PID unique to each invocation untill it finally wraps a 16 
> bit value, or will the kernel re-use them because they won't all be 
> running simultainiously, but limited by the number of unique 'spindle' 
> numbers on the system, this to prevent as best as it can, the thrashing 
> of a drive by having tar working on 2 separate (or more) partitions at 
> the same time.  In my case 2 are possible, as /var is on a separate 
> drive.

Yes there a risk of wrapping, but it is very small. You can add the command
line arguments to the file name if you want, like this :

#!/bin/sh
exec strace -f -o "output.$$.${*//\//_}" /bin/real.tar $@

It will name the output file "output.<pid>.<args>", replacing slashes with
underscores. This is very dirty but can help.

Cheers,
Willy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ