[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 18:44 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
==




[1003.1(2013)/Issue7+TC1 0001044]: Calling setsid as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been set as RELATED TO issue 0001208. 
== 
http://austingroupbugs.net/view.php?id=1044 
== 
Reported By:daurnimator
Assigned To:
== 
Project:1003.1(2013)/Issue7+TC1
Issue ID:   1044
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Editorial
Priority:   normal
Status: Resolved
Name:   Daurnimator 
Organization:
User Reference:  
Section:posix_spawn 
Page Number:0 
Line Number:0 
Interp Status:  --- 
Final Accepted Text:http://austingroupbugs.net/view.php?id=1044#c3650 
Resolution: Accepted As Marked
Fixed in Version:   
== 
Date Submitted: 2016-04-14 01:07 UTC
Last Modified:  2017-04-07 12:23 UTC
== 
Summary:Calling setsid as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001208 calling chdir as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-04-14 01:07 daurnimatorNew Issue
2016-04-14 01:07 daurnimatorName  => Daurnimator 
2016-04-14 01:07 daurnimatorSection   => posix_spawn 
2016-04-14 01:07 daurnimatorPage Number   => 0   
2016-04-14 01:07 daurnimatorLine Number   => 0   
2016-04-14 01:43 daurnimatorIssue Monitored: daurnimator
2016-08-19 08:26 Florian Weimer Issue Monitored: Florian Weimer 
  
2017-03-23 17:06 geoffclare Note Added: 0003650  
2017-03-23 17:09 geoffclare Note Edited: 0003650 
2017-03-30 15:13 geoffclare Interp Status => --- 
2017-03-30 15:13 geoffclare Final Accepted Text   =>
http://austingroupbugs.net/view.php?id=1044#c3650
2017-03-30 15:13 geoffclare Status   New => Resolved 
2017-03-30 15:13 geoffclare Resolution   Open => Accepted As
Marked
2017-03-30 15:13 geoffclare Tag Attached: issue8 
2017-04-05 02:50 daurnimatorNote Added: 0003658  
2017-04-07 10:52 geoffclare Note Edited: 0003650 
2017-04-07 10:54 geoffclare Note Added: 0003665  
2017-04-07 12:23 daurnimatorNote Added: 0003666  
2018-09-07 18:39 eblake Relationship added   related to 0001208  
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 18:46 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been set as RELATED TO issue 0001044. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 18:39 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been SUBMITTED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 18:39 UTC
== 
Summary:calling chdir as part of posix_spawn
Description: 
One notable missing feature from posix_spawn is the ability to change the
initial working directory of the new process.  Of course, in the common
case, it is possible to exec a shim process that will change the directory
(GNU coreutils has 'env -C dir program ...' that will do this, but the
standard itself does not have such a shim program, so users have to come up
with their own).  But even more complex is the fact that posix_spawn can
change access permissions with PSOIX_SPAWN_RESETIDS, such that the parent
may have permission to change to a particular directory, but the child with
a different id cannot do so.  There is also the case that a multi-threaded
parent process can use openat() to open files relative to a particular
directory without changing the global state of the current working
directory, but there is no interface for openat() within posix_spawn (and
it may be prohibitively expensive to convert a relative name into an
absolute one).  Thus, it can be argued that changing the directory needs to
be directly part of posix_spawn().

Solaris has implemented an extension for chdir with a _np suffix
(non-portable), and documents that relative names for
posix_spawn(,path) and posix_spawnp(,file) are interpreted to the
working directory selected for the child:

https://docs.oracle.com/cd/E86824_01/html/E54766/posix-spawn-file-actions-addchdir-np-3c.html

I'm proposing that we standardize this, but drop the _np suffix (since by
standardizing it, it will no longer be non-portable), and also add a
counterpart for fchdir.  The addition of fchdir makes it possible to
simulate openat semantics without actually needing to add
posix_spawn_file_actions_addopenat.

Note that I did not standardize the notion of a chroot file action (in part
due to no existing practice), although such an extension may still make
sense.

Fix a couple of issues in posix_spawn_file_addclose while at it: you can't
delete open/close actions from an existing file_actions object, only add
more; and ENOMEM should be a 'shall fail' rather than 'may fail' error to
match posix_spawn_file_adddup2.

Yes, the additions to the XRAT example are just as borked as the existing
implementation for handling an addopen action at lines 126723-126763 and
126852-126860 (very easy to write beyond end of fixed-length array, parse
failure on filename containing '*', failure to fail with EBADF for negative
filedes, etc) - but being consistently bad in something that is mainly for
demo purposes isn't the end of the world.  The use of _exit() instead of
exit() in the example matches the resolution for
http://austingroupbugs.net/view.php?id=1044.

Desired Action: 
Proposed changes (2017 edition page and line numbers):

On page 341 line 11588 (XBD ), insertint
posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t *restrict,
const char *restrict);

On page 341 line 11592 (), insertint
posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t *,
int);

On page 1453 line 48227 (XSH posix_spawn DESCRIPTION), change:a
pathname that identifies the new process image file to
execute.to:a pathname that identifies the new
process image file to execute; if the pathname does not start with a
 it shall be interpreted relative to the working directory of the
child process after all file_actions have been
performed.

On page 1453 line 48229, change:the file parameter shall
be used as the pathname for the new process image
file.to:the file parameter shall be used as
the pathname for the new process image file; if this pathname does not
start with a  it shall be interpreted relative to the working
directory of the child process after all file_actions have been
performed.

On page 1453 line 48239, add a 

Re: Status of pipefail for standardization

2018-09-07 Thread Robert Elz
Date:Fri, 7 Sep 2018 09:35:39 +0100
From:Geoff Clare 
Message-ID:  <20180907083539.GA5774@lt2.masqnet>

  | Since kre reported in bugnote 4102 that he added pipefail to the
  | NetBSD sh and it does not support arrays, it seems we have our
  | answer on that one.

I am not sure that what we do necessarily provides proof for anything,
but yes, pipefail is useful without being able to see the status of the
individual processes (which is what the "support arrays" side issue
is really all about.).It might be even more useful with that extra,
but sometimes simply knowing "did the entire pipe work, or did
anything fail?" is all that is needed - and my current impression is
that in many cases, that is exactly what is needed.

Before going on to the "what if" part of this message, I would also say
that in the NetBSD man page description of pipefail we handle the
exit status issue (with/without pipefail, with/without !) a little differently.
Our text defines a pipestatus for a pipeline, which is the thing that
pipefail controls, and then derives the exit status of a pipeline from
the pipestatus of that pipeline based upon the presence, or not, of
the ! word.   The effect is the same as the big table, but it is rather
more concise.

For when more than success/fail is needed, I still don't believe that
arrays are needed, the status information for a list of commands is
just a list of integers, and can easily be handled as a list using
traditional shell strings.  (This is not a case where random unknown
data needs to be handled, a space seeparated ordered list of
numbers would be just fine.)

And while in note 3905 Stephane provided a link to a web page showing
how the status information can be extracted now (with no additional
mechanism at all - not even pipefail) I kind of suspect that's rather more
complex than most people would want, and too susceptible to minor
errors (accidentally leave a \ out from ahead of one of the | and it fails
in not so obvious ways).

So, what would be needed, not to have pipefail, but to allow the status
to be extracted (pipefail enabled or not) would be some new mechanism
to provide the info (of which an array, or just a variable, with a magic
name is certtainly a possibility.)

I am not sure what the attitude is here to creating new special parameters,
the ones we have all seem to have originated in the original Bourne shell,
and no-one has ever added anything new (I actually had $+ for a short
while - never released anywhere - which was a comlpement to $- and
contained the single letter options that were not set ... more for symmetry
than to solve any real problem ... so it went away again).

But if anything cries out for a new special parameter it would be this - to
make the exit status of the processes that form a pipeline available.

If I had to pick something, I'd use $| and define it to be the a space
separated list of exit status values ($?) for the commands that form a
pipeline.   It would be set (and have a lifetime) exactly the same as
applies to $? - and in the case of a degenerate pipeline (a pipeline
with no pipe operators, ie: a simple command), $| and $? would be
identical (as they would be before any command had run.)

I have not implemented that, as there has been no demand, so I
cannot state that it will work (it is obviously implementable, just as it is
obviously possible to implement the array method, for shells willing
to add all the mechanism necessary to support arrays as a general
concept)  - and so it is way too early to even consider standardising
anything in this area - this is just so I can get a general "sense of
the room" as to whether this would be an acceptable solution, or
simply considered out of the question.

kre



Re: Status of pipefail for standardization

2018-09-07 Thread Geoff Clare
Drew DeVault  wrote, on 05 Sep 2018:
>
> On 2018-09-05  8:18 AM, Drew DeVault wrote:
> > Copying David on the thread. David, do you have some time to look over
> > this proposal for the POSIX shell?
> 
> My email to David bounced and I don't have a better address for him.
> Does anyone else have a way of getting in touch?

As discussed in yesterday's call, it seems unlikely that we will get
any input from David.

So the options are to try and get input from someone else who works
on ksh93 (e.g. Glenn Fowler?) or just to proceed with what we have
already.

I think the main question we were hoping for input on is whether
it is worth standardising pipefail without support for arrays.
Since kre reported in bugnote 4102 that he added pipefail to the
NetBSD sh and it does not support arrays, it seems we have our
answer on that one.

-- 
Geoff Clare 
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England



[1003.1(2016)/Issue7+TC2 0001130]: Address 0 does not make sense for the c command

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1130 
== 
Reported By:Antonio Diaz
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1130
Category:   Shell and Utilities
Type:   Error
Severity:   Objection
Priority:   normal
Status: Resolved
Name:   Antonio Diaz 
Organization:   GNU 
User Reference:  
Section:ed 
Page Number:2682 
Line Number:87448-87449 
Interp Status:  --- 
Final Accepted Text:See
http://austingroupbugs.net/view.php?id=1130#c4105 
Resolution: Accepted As Marked
Fixed in Version:   
== 
Date Submitted: 2017-03-21 17:07 UTC
Last Modified:  2018-09-07 08:17 UTC
== 
Summary:Address 0 does not make sense for the c command
==
Relationships   ID  Summary
--
related to  0001131 The synopsis of the i command is wrong ...
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2017-03-21 17:07 Antonio Diaz   New Issue
2017-03-21 17:07 Antonio Diaz   Name  => Antonio Diaz
2017-03-21 17:07 Antonio Diaz   Organization  => GNU 
2017-03-21 17:07 Antonio Diaz   Section   => ed  
2017-03-21 17:07 Antonio Diaz   Page Number   => 0   
2017-03-21 17:07 Antonio Diaz   Line Number   => 0   
2017-03-21 17:10 Antonio Diaz   Issue Monitored: Antonio Diaz   

2017-03-21 18:26 salty-horseIssue Monitored: salty-horse
2018-08-30 16:24 nick   Page Number  0 => 2682   
2018-08-30 16:24 nick   Line Number  0 => 87448-87449
2018-08-30 16:24 nick   Interp Status => --- 
2018-08-31 14:16 geoffclare Note Added: 0004098  
2018-09-06 16:33 geoffclare Relationship added   related to 0001131  
2018-09-06 16:36 nick   Note Added: 0004105  
2018-09-06 16:37 nick   Final Accepted Text   => See Bugnote:0004105
2018-09-06 16:37 nick   Status   New => Resolution
Proposed
2018-09-06 16:37 nick   Resolution   Open => Accepted As
Marked
2018-09-06 16:37 nick   Tag Attached: tc3-2008   
2018-09-06 16:38 nick   Status   Resolution Proposed =>
Resolved
2018-09-06 16:43 nick   Note Added: 0004107  
2018-09-06 16:43 nick   Note Edited: 0004107 
2018-09-07 08:17 geoffclare Final Accepted Text  See Bugnote:0004105 =>
See http://austingroupbugs.net/view.php?id=1130#c4105
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 19:29 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
2018-09-07 18:53 eblake Desired Action Updated   
2018-09-07 18:55 eblake Desired Action Updated   
2018-09-07 18:55 eblake Tag Attached: issue8 
2018-09-07 19:02 eblake Note Added: 0004109  
2018-09-07 19:04 eblake Desired Action Updated   
2018-09-07 19:29 eblake Desired Action Updated   
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 19:02 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

-- 
 (0004109) eblake (manager) - 2018-09-07 19:02
 http://austingroupbugs.net/view.php?id=1208#c4109 
-- 
Perhaps the two cleanups in posix_spawn_file_actions_addclose (deleting a
spurious "or delete", and turning ENOMEM into shall fail instead of may
fail) should be split into a separate bug targeted at TC3.  Also, such a
separate bug could add even more disclaimers into the XRAT example code
about how insecure it is, and that it exists merely as a starting point
rather than a robust implementation. 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
2018-09-07 18:53 eblake Desired Action Updated   
2018-09-07 18:55 eblake Desired Action Updated   
2018-09-07 18:55 eblake Tag Attached: issue8 
2018-09-07 19:02 eblake Note Added: 0004109  
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 19:35 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
2018-09-07 18:53 eblake Desired Action Updated   
2018-09-07 18:55 eblake Desired Action Updated   
2018-09-07 18:55 eblake Tag Attached: issue8 
2018-09-07 19:02 eblake Note Added: 0004109  
2018-09-07 19:04 eblake Desired Action Updated   
2018-09-07 19:29 eblake Desired Action Updated   
2018-09-07 19:35 eblake Description Updated  
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 18:49 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 18:55 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
2018-09-07 18:53 eblake Desired Action Updated   
2018-09-07 18:55 eblake Desired Action Updated   
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 18:51 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 18:53 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
2018-09-07 18:53 eblake Desired Action Updated   
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


The following issue has been UPDATED. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 19:04 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
2018-09-07 18:53 eblake Desired Action Updated   
2018-09-07 18:55 eblake Desired Action Updated   
2018-09-07 18:55 eblake Tag Attached: issue8 
2018-09-07 19:02 eblake Note Added: 0004109  
2018-09-07 19:04 eblake Desired Action Updated   
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 22:18 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

-- 
 (0004110) eblake (manager) - 2018-09-07 22:18
 http://austingroupbugs.net/view.php?id=1208#c4110 
-- 
As a side note: Windows CreateProcess() already supports changing
directories at the time of spawning a child. While you wouldn't typically
see posix_spawn() and CreateProcess() mixed in the same program, it is nice
to know that the concept of changing directory for the child process is
already common in an existing OS. 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
2018-09-07 18:53 eblake Desired Action Updated   
2018-09-07 18:55 eblake Desired Action Updated   
2018-09-07 18:55 eblake Tag Attached: issue8 
2018-09-07 19:02 eblake Note Added: 0004109  
2018-09-07 19:04 eblake Desired Action Updated   
2018-09-07 19:29 eblake Desired Action Updated   
2018-09-07 19:35 eblake Description Updated  
2018-09-07 22:18 eblake Note Added: 0004110  
==




[1003.1(2016)/Issue7+TC2 0001208]: calling chdir as part of posix_spawn

2018-09-07 Thread Austin Group Bug Tracker


A NOTE has been added to this issue. 
== 
http://austingroupbugs.net/view.php?id=1208 
== 
Reported By:eblake
Assigned To:
== 
Project:1003.1(2016)/Issue7+TC2
Issue ID:   1208
Category:   System Interfaces
Type:   Enhancement Request
Severity:   Objection
Priority:   normal
Status: New
Name:   Eric Blake 
Organization:   Red Hat 
User Reference: posix_spawn.chdir 
Section:posix_spawn 
Page Number:1452 ff. 
Line Number:48227 ff. 
Interp Status:  --- 
Final Accepted Text: 
== 
Date Submitted: 2018-09-07 18:39 UTC
Last Modified:  2018-09-07 22:44 UTC
== 
Summary:calling chdir as part of posix_spawn
==
Relationships   ID  Summary
--
related to  0001044 Calling setsid as part of posix_spawn
== 

-- 
 (0004111) eblake (manager) - 2018-09-07 22:44
 http://austingroupbugs.net/view.php?id=1208#c4111 
-- 
In fact, we could get by with JUST
posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t*, int),
since:

posix_spawn_file_actions_addchdir(, "foo");

can be rewritten as:

posix_spawn_file_actions_addopen(, 5, "foo",
O_RDONLY|O_DIRECTORY|O_CLOEXEC, 0);
posix_spawn_file_actions_addfchdir(, 5);

modulo any issues with running out of available fds.

Since the existing Solaris implementation uses const char* for the
_addchdir() name, we'd definitely want to spell things as addfchdir() for
an int version rather than risk confusion why addchdir() takes a different
type than addchdir_n().

But with that said, here's an exploratory patch originally proposed to
glibc implementing an fchdir action under the name addchdir() (but which
never went anywhere at the time) - 8 years ago!
https://sourceware.org/ml/libc-alpha/2010-08/msg00107.html 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2018-09-07 18:39 eblake New Issue
2018-09-07 18:39 eblake Name  => Eric Blake  
2018-09-07 18:39 eblake Organization  => Red Hat 
2018-09-07 18:39 eblake User Reference=> posix_spawn.chdir
2018-09-07 18:39 eblake Section   => posix_spawn 
2018-09-07 18:39 eblake Page Number   => 1452 ff.
2018-09-07 18:39 eblake Line Number   => 48227 ff.   
2018-09-07 18:39 eblake Interp Status => --- 
2018-09-07 18:39 eblake Relationship added   related to 0001044  
2018-09-07 18:44 eblake Desired Action Updated   
2018-09-07 18:46 eblake Desired Action Updated   
2018-09-07 18:49 eblake Desired Action Updated   
2018-09-07 18:51 eblake Desired Action Updated   
2018-09-07 18:53 eblake Desired Action Updated   
2018-09-07 18:55 eblake Desired Action Updated   
2018-09-07 18:55 eblake Tag Attached: issue8 
2018-09-07 19:02 eblake Note Added: 0004109  
2018-09-07 19:04 eblake Desired Action Updated   
2018-09-07 19:29 eblake Desired Action Updated   
2018-09-07 19:35 eblake Description Updated  
2018-09-07 22:18 eblake Note Added: 0004110  
2018-09-07 22:44 eblake Note Added: 0004111  
==




Re: [RFC/PATCH glibc 0/2] setting working dir in posix_spawn()

2018-09-07 Thread Eric Blake

[reviving a REALLY old thread]
https://sourceware.org/ml/libc-alpha/2010-08/msg00107.html

On 08/27/2010 01:35 AM, Jonathan Nieder wrote:

(pruned cc's, +cc:libc-alpha)

Eric Blake wrote:

On 08/26/2010 12:18 AM, Jonathan Nieder wrote:



Do you think there would be any interest in a posix_spawn() variant
that takes a dir parameter?  I am imagining something like this:


Of your variants, I would most prefer:


  int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t
*file_actions, int dirfd);


Today, I just submitted http://austingroupbugs.net/view.php?id=1208, 
then in searching my mail archives, I found this related thread that 
never had a response at the time, so I'm now offering a reply.  Compared 
to my thoughts 8 years ago, my new writeup proposed


int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t 
*restrict file_actions, const char *restrict name);
int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t 
*file_actions, int dirfd);


which is slightly different from your RFC based on my older thoughts. 
But in re-reading your email, I see that we could indeed get by with 
JUST the fchdir() signature, since chdir("foo") can generally be 
decomposed into fchdir(open("foo", O_RDONLY|O_DIRECTORY)).




Okay, here's a proof of concept (for the easy case --- a fork()-
based implementation for Linux).  Patches apply to 8b2b771^.


For that matter, it may also be worth adding
posix_spawn_file_actions_addopenat, which mirrors the recent
addition of openat() semantics.


Sounds like a good idea.  I did not try it because I did not want to
think about whether it would cause the __spawn_action struct to grow
(and if so, what ramifications that would have, if any).


Also, I've realized that we do NOT need 
posix_spawn_file_actions_addopenat(). The main benefit of openat() is 
that you can redirect relative file names according to an fd of your 
choice, without affecting global state. But during posix_spawn(), there 
are no other threads competing for global state (if you are doing a 
library implementation where the chdir() is done between fork() and 
exec()), so:


openat(mydir, "file", mode);

can be decomposed to:

posix_spawn_file_actions_addopen(, 5, ".", O_RDONLY|O_DIRECTORY, 0);
posix_spawn_file_actions_addfchdir(, mydir);
posix_spawn_file_actions_addopen(, 4, "file", mode, 0);
posix_spawn_file_actions_addfchdir(, 5);
posix_spawn_file_actions_addclose(, 5);

We don't need to add posix_spawn_file_actions_addFOO for every possible 
FOO that typically gets called between fork/exec, as long as we can 
string together enough bare components to get the feature parity within 
the single-threaded context of posix_spawn() for what is otherwise 
expensive if done in the parent as a wrapper around posix_spawn(), even 
if it adds more verbosity into the posix_spawn_* calls require to get 
the same desired effects.


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org