Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2000 16:12:23 +1000 (EST)
From:      Bruce Campbell <bc-freebsd@vicious.dropbear.id.au>
To:        "Daniel O'Connor" <doconnor@gsoft.com.au>
Cc:        current@freebsd.org
Subject:   Re: mktemp() patch
Message-ID:  <Pine.BSF.4.21.0006081600420.34018-100000@julubu.staff.apnic.net>
In-Reply-To: <XFMail.000608140545.doconnor@gsoft.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 8 Jun 2000, Daniel O'Connor wrote:

doconn> On 08-Jun-00 Kris Kennaway wrote:
doconn> >  On Thu, 8 Jun 2000, Boris Popov wrote:
doconn> >  
doconn> > > > Instead of using only alphabetic characters, the patch uses the following
doconn> > > > character set:
doconn> > > > 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@#%^-_=+:,.~
doconn> > >     Symbols '=' and '+' are prohibited in some other filesystems. It
doconn> > > is possible to avoid using them ?
doconn> >  Yes, but at the expense of weakening the number of possible random
doconn> >  filenames :-(
doconn> 
doconn> IMHO the loss of 2 characters doesn't greatly reduce the number of
doconn> possibilities, but it DOES greatly reduce the chance of an obscure error
doconn> message appearing when you try and make a temp file on a brain dead FS.

mkstemp() actually creates the file if possible.  If the creation of the
file fails (and not due to race condition), retry the algorithm without
'suspect' characters.  That way, you don't lose out on the extra 13% of
possibilities when running on a 'real' filesystem ;)

Since mktemp() only returns the suggested filename, you lose, unless
mktemp() starts examining the mounted filesystems for known character
no-nos.

Its a pity that one cannot pass the allowable list of characters to
mktemp() and related functions.

--==--
Bruce.

Common Sense, Inc.






To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0006081600420.34018-100000>