-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ubuntu 12.4 sets errno for a successful call to pathconf #12095
Comments
From @nwc10This is blead on a machine upgraded to Ubuntu 12.4 only a few days ago Which is this: $ ./perl -Ilib -MPOSIX -lwe '$!=0; which seems to be because Ubuntu 12.4 is a special and unique snowflake, and Here's my test program: #include <unistd.h> int main(int argc, char **argv) { errno = 0; printf("_PC_LINK_MAX for '%s' is %ld, errno is %d\n", fd = open(*argv, O_RDONLY); printf("_PC_LINK_MAX for '%s' using fd %d is %ld, errno is %d\n", On that Ubuntu machine: $ ./pathconf /tmp ._PC_LINK_MAX for '/tmp' is 32000, errno is 2 On a FreeBSD machine with a network mounted /home: $ ./pathconf /tmp . On a genuine Debian* system: $ ./pathconf /tmp . So, yes, special and unique. However, I'm told POSIX says nothing about But, hmm, this isn't helpful. Nicholas Clark * well, a released Debian system. Is Ubuntu simply releasing now what Debian Perl Info
|
From @jmdhOn Fri, May 11, 2012 at 08:24:51AM -0700, Nicholas Clark wrote:
On up-to-date Debian unstable: dom@kale:~$ cat /etc/debian_version -- |
The RT System itself - Status changed from 'new' to 'open' |
From [email protected]On Fri, May 11, 2012 at 8:24 AM, Nicholas Clark
This is from 12.04 desktop installed fresh just yesterday. $ uname -a $ cat /etc/lsb-release $ ./pathconf /tmp . specialer and specialer... ____ |
From @pjcjOn Fri, May 11, 2012 at 08:24:51AM -0700, Nicholas Clark wrote:
As usual, it's more complicated than that in practice. In general, you are not supposed to read anything into the value of However, for some functions all possible return values can indicate And then there are functions which don't promise to set errno even on Further, there are functions which don't have a specified return value Now, because our implementation of $! is so close to plain errno this In the case of pathconf and fpathconf the return value is the limit, if This means that we should set $! to 0 before calling f?pathconf, but we Looking at ext/POSIX/t/sysconf.t in more detail, I think it is checking And then there's sysconf() which is being tested in the same fashion as I can put together a patch for this over the weekend unless anyone else -- |
From @nwc10On Sat, May 12, 2012 at 02:00:04AM +0200, Paul Johnson wrote:
a) I'm busy in the garden all weekend. First dry weekend in ages Nicholas Clark |
From [email protected]This problem is caused by glibc 2.15. f?pathconf() was fixed to check Skipping the test sounds like the only sane solution, possibly with a Vincent. |
From @pjcjOn Sun, May 13, 2012 at 11:21:05AM +0100, Nicholas Clark wrote:
I think the best we can do with respect to the f?pathconf tests is to With respect to the sysconf call, I think we shouldn't test more than The attached patch makes these changes. I'd very much appreciate a Matters to consider include: - Does the test now pass on Ubuntu systems where it previously failed? -- |
From @pjcjsysconf.t.patchdiff --git a/ext/POSIX/t/sysconf.t b/ext/POSIX/t/sysconf.t
index 65625a8..8590eef 100644
--- a/ext/POSIX/t/sysconf.t
+++ b/ext/POSIX/t/sysconf.t
@@ -33,10 +33,10 @@ my @sys_consts = check qw(
_SC_STREAM_MAX _SC_VERSION _SC_TZNAME_MAX
);
-my $tests = 2 * 3 * @path_consts +
- 2 * 3 * @path_consts_terminal +
- 2 * 3 * @path_consts_fifo +
- 3 * @sys_consts;
+my $tests = 2 * 2 * @path_consts +
+ 2 * 2 * @path_consts_terminal +
+ 2 * 2 * @path_consts_fifo +
+ 1 * @sys_consts;
plan $tests
? (tests => $tests)
: (skip_all => "No tests to run on this OS")
@@ -58,17 +58,17 @@ sub _check_and_report {
my $return_val = eval {$sub->(eval "$constant()")};
my $errno = $!; # Grab this before anything else changes it.
is($@, '', $description);
- SKIP: {
- skip "terminal constants set errno on QNX", 1
- if $^O eq 'nto' and $description =~ $TTY;
- cmp_ok($errno, '==', 0, 'errno should be clear in all cases')
- or diag("\$!: $errno");
- }
- SKIP: {
- skip "constant not implemented on $^O or no limit in effect", 1
- if !defined($return_val);
- like($return_val, qr/\A(?:-?[1-9][0-9]*|0 but true)\z/,
+
+ # We can't test sysconf further without investigating the type of argument
+ # provided
+ return if $description =~ /sysconf/;
+
+ if (defined $return_val) {
+ like($return_val, qr/\A(?:-?[1-9][0-9]*|0 but true)\z/,
'the returned value should be a signed integer');
+ } else {
+ cmp_ok($errno, '==', 0, 'errno should be 0 as before the call')
+ or diag("\$!: $errno");
}
}
@@ -76,7 +76,7 @@ sub _check_and_report {
SKIP: {
my $fd = POSIX::open($testdir, O_RDONLY)
or skip "could not open test directory '$testdir' ($!)",
- 3 * @path_consts;
+ 2 * @path_consts;
for my $constant (@path_consts) {
_check_and_report(sub { fpathconf($fd, shift) }, $constant,
@@ -93,7 +93,7 @@ for my $constant (@path_consts) {
}
SKIP: {
- my $n = 2 * 3 * @path_consts_terminal;
+ my $n = 2 * 2 * @path_consts_terminal;
-c $TTY
or skip("$TTY not a character file", $n);
@@ -122,11 +122,11 @@ my $fifo = "fifo$$";
SKIP: {
eval { mkfifo($fifo, 0666) }
- or skip("could not create fifo $fifo ($!)", 2 * 3 * @path_consts_fifo);
+ or skip("could not create fifo $fifo ($!)", 2 * 2 * @path_consts_fifo);
SKIP: {
my $fd = POSIX::open($fifo, O_RDONLY | O_NONBLOCK)
- or skip("could not open $fifo ($!)", 3 * @path_consts_fifo);
+ or skip("could not open $fifo ($!)", 2 * @path_consts_fifo);
for my $constant (@path_consts_fifo) {
_check_and_report(sub { fpathconf($fd, shift) }, $constant,
@@ -150,7 +150,7 @@ END {
SKIP: {
if($^O eq 'cygwin') {
pop @sys_consts;
- skip("No _SC_TZNAME_MAX on Cygwin", 3);
+ skip("No _SC_TZNAME_MAX on Cygwin", 1);
}
}
|
From @jkeenanOn 5/13/12 6:50 PM, Paul Johnson wrote:
FWIW, applying the patch on a close-to-HEAD checkout of blead works for Thank you very much. |
From [email protected]
It passes on my glibc-2.15 system. |
From @jmdhOn Mon, May 14, 2012 at 12:50:01AM +0200, Paul Johnson wrote:
It passes on my Debian unstable-chroot-on-ext3 system where it previously Thanks, -- |
From @nwc10On Mon, May 14, 2012 at 12:50:01AM +0200, Paul Johnson wrote:
Yes, seems that everyone who had reported failure now reports success.
I have no idea.
I've not checked the skips yet. I have pushed it as smoke-me/rt112866 to see Even if it passes everywhere it's tested, we shouldn't merge it until we've Nicholas Clark |
From @jmdhOn Mon, May 14, 2012 at 09:52:46AM +0100, Nicholas Clark wrote:
This is my attempt to check the skips: sub _check_and_report is responsible for: The first SKIP: The second SKIP: The third SKIP: The fifth SKIP: I think the numbers of tests skipped is correct. Dominic. -- |
@nwc10 - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#112866 (status was 'resolved')
Searchable as RT112866$
The text was updated successfully, but these errors were encountered: