[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: etiquette of sharing executable files



On Sun, Jul 07, 2019 at 11:58:21AM +0200, john doe wrote:
> On 7/6/2019 9:34 PM, mick crane wrote:
> > As per recent post ( don't want to trash somebody's home directory ) I
> > was wondering what is the etiquette of sharing executable files.
> > I've never really thought about giving executable files to anybody but
> > just recently while I'm getting my bits of code to work I was thinking
> > "I have to be a bit careful what I put here because I might delete
> > something I'd be unhappy about.
> > And then hmmm, if I did give this to somebody else if they didn't know
> > what did what they might trash they're home directory.
> > I decided to follow the advice and not delete anything and I don't need
> > to need to renumber now.
> > And I decided to go through everything and put in error checking as much
> > as able.
> > So the question is about the etiquette.
> > Install scripts could make directories willy nilly in user home
> > directory but you might think that could be rude ?
> 
> Then test if the script is run as root and restrict where the script can
> work in (/tmp/...)
> 
> > And what happens if by mischance there already exists a directory with
> > the same name ?
> 
> Use as part of your directory name a random string:

Please. Don't reinvent that wheel. Use mktemp and family. Available
as (C) library function, shell command and Perl module (use File::Temp
for that). I'm sure other languages with enough roots in an Unix-like
operating system will have some variation on that.

It's not exactly trivial to roll that on your own and avoid collisions
and/or race conditions.

Cheers
-- tomás

Attachment: signature.asc
Description: Digital signature


Reply to: