php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48820 ttyname_r() configure test unreliable
Submitted: 2009-07-06 16:22 UTC Modified: 2009-07-15 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: arekm at maven dot pl Assigned:
Status: No Feedback Package: POSIX related
PHP Version: 5.2.10, 5.3.0 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: arekm at maven dot pl
New email:
PHP Version: OS:

 

 [2009-07-06 16:22 UTC] arekm at maven dot pl
Description:
------------
ttyname_r() check done in configure is wrong because it relies on doing build on a terminal. Building on non terminal causes failure.

Reproduce code:
---------------
This is test taken from configure:

[arekm@t400 ~/test/3]$ more a.c
#include <unistd.h>
int main(int argc, char *argv[])
{
        char buf[64];

        return ttyname_r(0, buf, 64) ? 1 : 0;
}

[arekm@t400 ~/test/3]$ gcc a.c
[arekm@t400 ~/test/3]$ ./a.out
[arekm@t400 ~/test/3]$ echo $?
0

success - we are on a terminal

[arekm@t400 ~/test/3]$ ./a.out < /dev/null
zsh: exit 1     ./a.out < /dev/null
[arekm@t400 ~/test/3]$ echo $?
1
[arekm@t400 ~/test/3]$

failure - we are not on terminal


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-07 15:34 UTC] jani@php.net
I feel a bit stupid for asking this..but how/why do you build in non terminal..? :)
 [2009-07-07 18:31 UTC] arekm at maven dot pl
I'm building using rpm and it doesn't provide terminal as stdin to configure - ttyname_r() check fails.
 [2009-07-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2011-02-20 22:03 UTC] glen at delfi dot ee
The simpliest explanation how to build without terminal: run your build job from 
cron daemon [1] or just use </dev/null as input to configure (as arekm noted) to 
get same result

as of php-5.3.5/ext/posix/config.m4 the detection code is still wrong.

[1] http://en.wikipedia.org/wiki/Cron
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC