Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000503 [1003.1(2008)/Issue 7] System Interfaces Objection Omission 2011-11-08 00:28 2019-06-10 08:55
Reporter eblake View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Eric Blake
Organization Red Hat
User Reference ebb.ptsname
Section ptsname
Page Number 1712
Line Number 54754
Interp Status ---
Final Accepted Text Note: 0001004
Summary 0000503: ptsname should define optional errno values
Description Some platforms implement ptsname() in terms of an initial isatty() check on
the fd, or via a use of ttyname_r(); since both of these functions have an
optional but defined value for errno on failure, ptsname() should be allowed
to use the same errno values.
Desired Action At line 54750, after "shall return a null pointer", add ", and may set errno".

At line 54754, replace "No errors are defined." with:

The ptsname( ) function may fail if:
[EBADF] The fildes argument is not a valid open file descriptor.
[ENOTTY] The file associated with the fildes argument is not a terminal.
Tags tc2-2008
Attached Files

- Relationships
parent of 0000618Under Reviewajosey require isatty and friends to set errno on failure 
related to 0000506Closedajosey additional grantpt errors are possible 
related to 0000508Closedajosey Add ptsname_r 
Not all the children of this issue are yet resolved or closed.

-  Notes
(0001004)
msbrown (manager)
2011-11-10 16:28

At line 54750, after "shall return a null pointer", add ", and may set errno".

At line 54754, replace "No errors are defined." with:

The ptsname( ) function may fail if:
[EBADF] The fildes argument is not a valid file descriptor.
[ENOTTY] The file associated with the fildes argument is not a master pseudo-terminal device..
(0001005)
eblake (manager)
2011-11-10 17:45

On further investigation, implementations differ on whether they report
ENOTTY or EINVAL when using a function that requires the master side of a
pseudo-terminal, whereas the standard suggests EINVAL for grantpt() and
unlockpt(). This program shows that Solaris uses ENOTTY for all three
methods, while Linux used ENOTTY for two and EINVAL for granpt:

#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
int main() {
    int fd = open(".", O_RDONLY);
    errno = 0;
    ptsname(fd);
    printf("%d %s\n", errno, strerror(errno));
    errno = 0;
    unlockpt(fd);
    printf("%d %s\n", errno, strerror(errno));
    errno = 0;
    grantpt(fd);
    printf("%d %s\n", errno, strerror(errno));
    return 0;
}

I think the proposal needs to be broadened to allow either error on all
three functions. Still, since all three functions use may fail rather
than shall fail, I don't think any interpretation is needed.
(0001006)
eblake (manager)
2011-11-10 17:51

At line 36466 [grantpt], change "shall return -1 and set errno" to
"shall return -1, and may set errno"

At line 36471, change "[EINVAL]" to "[EINVAL] or [ENOTTY]"

At line 54750 [ptsname], after "shall return a null pointer", add ", and
may set errno"

At line 54754, replace "No errors are defined." with:

The ptsname( ) function may fail if:
[EBADF] The fildes argument is not a valid file descriptor.
[EINVAL] or [ENOTTY] The filedes argument is not associated with a
master pseudo-terminal device.

At line 68222 [unlockpt], change "shall return -1 and set errno" to
"shall return -1, and may set errno"

At line 68227, change "[EINVAL]" to "[EINVAL] or [ENOTTY]"
(0001385)
eblake (manager)
2012-10-02 19:31
edited on: 2012-10-02 19:32

For TC2, we went with Note: 0001004; but the ideas in Note: 0001006 and further discussion on the reflector led to the creation of 0000618 for Issue 8.


- Issue History
Date Modified Username Field Change
2011-11-08 00:28 eblake New Issue
2011-11-08 00:28 eblake Status New => Under Review
2011-11-08 00:28 eblake Assigned To => ajosey
2011-11-08 00:28 eblake Name => Eric Blake
2011-11-08 00:28 eblake Organization => Red Hat
2011-11-08 00:28 eblake User Reference => ebb.ptsname
2011-11-08 00:28 eblake Section => ptsname
2011-11-08 00:28 eblake Page Number => 1712
2011-11-08 00:28 eblake Line Number => 54754
2011-11-08 00:28 eblake Interp Status => ---
2011-11-10 16:25 msbrown Tag Attached: tc2-2008
2011-11-10 16:28 msbrown Interp Status --- => Pending
2011-11-10 16:28 msbrown Note Added: 0001004
2011-11-10 16:28 msbrown Status Under Review => Resolved
2011-11-10 16:28 msbrown Resolution Open => Accepted As Marked
2011-11-10 16:28 msbrown Final Accepted Text => Note: 0001004
2011-11-10 16:29 msbrown Interp Status Pending => ---
2011-11-10 17:45 eblake Note Added: 0001005
2011-11-10 17:51 eblake Note Added: 0001006
2011-11-10 18:12 eblake Relationship added related to 0000506
2011-11-10 21:27 eblake Relationship added related to 0000508
2012-09-12 17:57 emaste Issue Monitored: emaste
2012-10-02 19:31 eblake Note Added: 0001385
2012-10-02 19:32 eblake Relationship added parent of 0000618
2012-10-02 19:32 eblake Note Edited: 0001385
2019-06-10 08:55 agadmin Status Resolved => Closed


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker