env - ... unsets HOME among others causing cd with no args to fail as it
should

after the cd -@ x1 does this create a foo file?
: > /dev/file/xattr@/home/test001/tmp/x1//@//foo



On Tue, Dec 3, 2013 at 7:02 PM, Roland Mainz <[email protected]>wrote:

> On Wed, Dec 4, 2013 at 12:45 AM, Roland Mainz <[email protected]>
> wrote:
> > On Tue, Dec 3, 2013 at 8:13 PM, Glenn Fowler <[email protected]>
> wrote:
> >> On Tue, Dec 3, 2013 at 12:02 PM, Simon Toedt <[email protected]>
> wrote:
> >>> On Tue, Dec 3, 2013 at 5:19 PM, Glenn Fowler <[email protected]
> >
> >>> wrote:
> >>> > i don't really care for the utility of -p but it seems to be working
> as
> >>> > advertised
> >>> > try something like: mktemp myprefix "$PWD"
> >>>
> >>> ksh -c 'builtin mktemp ; touch x1 ; cd -@ x1 ; mktemp myprefix "$PWD"
> >>> ; :'
> >>> /tmp/myprejFqre.FAL
> >>>
> >>> > or mktemp "" "$PWD"
> >>>
> >>> does not work either
> >>>
> >>> >
> >>> > mktemp --?p
> >>> >   -p, --default=directory
> >>> >                   Use directory if the TMPDIR environment variable is
> >>> > not
> >>> > defined. Implies --tmp.
> >>> >
> >>> > gnu man mktemp
> >>> >        -p DIR use DIR as a prefix; implies -t [deprecated]
> >>> >
> >>> >        -t     interpret TEMPLATE as a single file name component,
> >>> > relative
> >>> > to a directory: $TMPDIR, if set; else  the
> >>> >               directory specified via -p; else /tmp [deprecated]
> >>> >
> >>>
> >>> What I wish to archive is to get a temporary file in the O_XATTR dir
> >>> so that the temp file disappears when I remove the underlying parent
> >>> file.
> >>>
> >>> And I am confused: Why does this not work? I'd expect a temporary file
> >>> in /dev/file/xattr@/home/stoe/x1//@//, but instead always get one in
> >>> /tmp:
> >>> env - /bin/ksh -x -c 'builtin mktemp ; touch x1 ; cd -@ x1 ;
> >>> TMPDIR="$PWD" ; mktemp "" "$PWD" ; :'
> >>> + builtin mktemp
> >>> + touch x1
> >>> + cd -@ x1
> >>> + TMPDIR=/dev/file/xattr@/home/stoe/x1//@//
> >>> + mktemp '' /dev/file/xattr@/home/stoe/x1//@//
> >>> /tmp/8nR0snQsJI.JID
> >>> + :
> >>> env - /bin/ksh -x -c 'builtin mktemp ; touch x1 ; cd -@ x1 ;
> >>> TMPDIR="$PWD" ; mktemp ; :'
> >>> + builtin mktemp
> >>> + touch x1
> >>> + cd -@ x1
> >>> + TMPDIR=/dev/file/xattr@/home/stoe/x1//@//
> >>> + mktemp
> >>> /tmp/tmp5Sy9yoF.syY
> >>> + :
> >>
> >> what does this output (-u prints the tmp file but does not create)
> >> --
> >> set -x
> >> mktemp --?-version
> >> cd
> >> print $PWD
> >> mktemp -u "" "$PWD"
> >> touch x1
> >> cd -@ x1
> >> mktemp -u "" "$PWD"
> >> cd -
> >> rm x1
> >
> > The output of that script looks like this with ast-ksh.2013-10-10 on
> > Solaris 11/B145/AMD64/64bit:
> > -- snip --
> > $ env - ~/bin/ksh xxx.sh
> > + mktemp '--?-version'
> >   version         mktemp (AT&T Research) 2012-12-12
> > + cd
> > xxx.sh[3]: cd: bad directory
> > + print /home/test001/tmp
> > /home/test001/tmp
> > + mktemp -u '' /home/test001/tmp
> > /home/test001/tmp/4sfuBB7Hll.llT
> > + touch x1
> > + cd -@ x1
> > + mktemp -u '' /dev/file/xattr@/home/test001/tmp/x1//@//
> > /tmp/hWzxGz8X0v.0vJ
> > + cd -
> > /home/test001/tmp
> > + rm x1
> > -- snip --
>
> Interesting... the (likely unrelated to the original issue)
> "xxx.sh[3]: cd: bad directory" only happens if I launch the shell with
> $ env - ~/bin/ksh ... # ... does anyone know why ?
>
> ----
>
> Bye,
> Roland
>
> --
>   __ .  . __
>  (o.\ \/ /.o) [email protected]
>   \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
>   /O /==\ O\  TEL +49 641 3992797
>  (;O/ \/ \O;)
>
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to