Re: [PATCH nft] tests: shell: don't rely on writable test directory

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

 



On Tue, Oct 29, 2024 at 08:14:01AM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote:
> > On Tue, Oct 22, 2024 at 04:09:54PM +0200, Florian Westphal wrote:
> > >  tmpfile1=$(mktemp -p .)
> > > -if [ ! -w $tmpfile1 ] ; then
> > > +if [ ! -w "$tmpfile1" ] ; then
> > >          echo "Failed to create tmp file" >&2
> > > -        exit 0
> > > +        exit 77
> > >  fi
> > >  
> > > +trap "rm -rf $tmpfile1 $tmpfile2" EXIT # cleanup if aborted
> > > +set -e
> > > +
> > >  tmpfile2=$(mktemp -p .)
> > > -if [ ! -w $tmpfile2 ] ; then
> > > +if [ ! -w "$tmpfile2" ] ; then
> > >          echo "Failed to create tmp file" >&2
> > >          exit 0
> > 
> > this does not return 77, see below...
> 
> I only changed first invocation, if pwd is ro, that will
> have failed already.

Right.

> I can make that consistent if you prefer.

Sure, go ahead and push this out if it helps you with virtme-ng

Thanks!




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux