* Herbert Xu:
> Paul Jackson <[EMAIL PROTECTED]> wrote:
>>
>> Even mktemp(1) can collide, in theory, since there is no practical way
>> in shell scripts to hold open and locked the file from the instant of it
>> is determined to be a unique name.
>
> mktemp(1) creates the file before exiting. Ot
Herbert wrote:
> mktemp(1) creates the file before exiting. ... O_EXCL
Aha - right you are. Thanks for pointing that out.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[EMAIL PROTECTED]> 1.650.933.1373,
Paul Jackson <[EMAIL PROTECTED]> wrote:
>
> Even mktemp(1) can collide, in theory, since there is no practical way
> in shell scripts to hold open and locked the file from the instant of it
> is determined to be a unique name.
mktemp(1) creates the file before exiting. Other instances of mktemp(
> No, you have to:
How does this compare with the one I posted about 1 hour 30
minuts ago:
tmp=${TMPDIR-/tmp}
tmp=$tmp/gitdiff-do.$RANDOM.$RANDOM.$RANDOM.$$
(umask 077 && mkdir $tmp) || {
echo "Could not create temporary directory! Exiting." 1>&2
No, you have to:
(a) create a unique, pid specific file name /var/tmp/myapp.$$.xyzzy
(b) create it in O_EXCL mode, so you wont smash another's held lock
(b-1) It worked, OK
(b-2) open failed, try ...xyzzz
repeat until (b-1)
There are thousands of examples of how to do this with bash.
Paul Jack
Erik wrote:
> How about putting using .git/tmp.$$ or similar as tempfile?
One could, but best to normally honor the users TMPDIR setting.
Could one 'git diff' a readonly git repository?
Perhaps someone has a reason for putting their tmp files where
they choose - say a local file system in a heav
Dave wrote:
> http://www.linuxsecurity.com/content/view/115462/151/
Nice - thanks.
Pasky - would you be interested in a patch that used a more robust tmp
file creation, along the lines of replacing
t=${TMPDIR:-/usr/tmp}/gitdiff.$$
trap 'set +f; rm -fr $t.?; trap 0; exit 0' 0 1 2
ks in this
directory)
David Lang
On Sat, 16 Apr 2005, Dave Jones wrote:
Date: Sat, 16 Apr 2005 20:57:57 -0400
From: Dave Jones <[EMAIL PROTECTED]>
To: Paul Jackson <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED], git@vger.kernel.org, [EMAIL PROTECTED]
Subject: Re: fix mktemp (remove mktemp
On Sat, Apr 16, 2005 at 05:44:09PM -0700, Paul Jackson wrote:
> Dave wrote:
> > mktemp is being used here to provide randomness in the filename,
> > not just a uniqueness.
>
> Ok - useful point.
>
> How about:
>
> t=${TMPDIR:-/usr/tmp}/gitdiff.$$.$RANDOM
pid is still predictable b
On Sat, Apr 16, 2005 at 08:33:25PM -0400, Dave Jones wrote:
> On Sat, Apr 16, 2005 at 05:02:21PM -0700, Paul Jackson wrote:
> > > And racy. And not guaranteed to come up with fresh new files.
> >
> > In theory perhaps. In practice no.
> >
> > Even mktemp(1) can collide, in theory, since the
Dave wrote:
> mktemp is being used here to provide randomness in the filename,
> not just a uniqueness.
Ok - useful point.
How about:
t=${TMPDIR:-/usr/tmp}/gitdiff.$$.$RANDOM
> all an attacker has to do is create 65535 symlinks in /usr/tmp
And how about if I removed the tmp files at th
On Sat, Apr 16, 2005 at 05:02:21PM -0700, Paul Jackson wrote:
> > And racy. And not guaranteed to come up with fresh new files.
>
> In theory perhaps. In practice no.
>
> Even mktemp(1) can collide, in theory, since there is no practical way
> in shell scripts to hold open and locked the f
> And racy. And not guaranteed to come up with fresh new files.
In theory perhaps. In practice no.
Even mktemp(1) can collide, in theory, since there is no practical way
in shell scripts to hold open and locked the file from the instant of it
is determined to be a unique name.
The window of vul
> /usr/tmp/ ??? Hey, /usr may be mounted read-only! Why not just use /tmp ?
Sure - that's fine to change. Those that care will have TMPDIR set anyway.
I probably made that choice of /usr/tmp for the fallback 10 or 20 years
ago, and have never had reason to revisit it. I have long forgotten why
Dear diary, on Sun, Apr 17, 2005 at 01:27:43AM CEST, I got a letter
where Paul Jackson <[EMAIL PROTECTED]> told me that...
> Remove mktemp usage - it doesn't work on
> some Mandrakes, nor on my SuSE 8.2 with
> mktemp-1.5-531.
>
> Replace with simple use of $$ (pid).
> I've been using this same pat
On Sat, 2005-04-16 16:27:43 -0700, Paul Jackson <[EMAIL PROTECTED]>
wrote in message <[EMAIL PROTECTED]>:
> Index: git-pasky-0.4/gitcommit.sh
> ===
> --- git-pasky-0.4.orig/gitcommit.sh 2005-04-12 10:39:14.0 -0700
> +++ git-p
Remove mktemp usage - it doesn't work on
some Mandrakes, nor on my SuSE 8.2 with
mktemp-1.5-531.
Replace with simple use of $$ (pid).
I've been using this same pattern for
20 years on many production scripts;
it's fast, solid and simple.
More robust tmp file removal, using trap,
so that scripts i
17 matches
Mail list logo