Package: perl Version: 5.8.8-7 Severity: normal [EMAIL PROTECTED]:~/src/ikiwiki>strace perl -e 'open OUT, ">foo"; print OUT "" || die "$!"; close OUT' 2>&1 |grep ioctl ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfa59448) = -1 EINVAL (Invalid argument) ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfa59448) = -1 EINVAL (Invalid argument) ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfa59508) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfa594d8) = -1 ENOTTY (Inappropriate ioctl for device) write(2, "Inappropriate ioctl for device a"..., 45Inappropriate ioctl for device at -e line 1.
I feel this is a perl bug, because the docs for print state that it returns true if it's successful, and it's sucessfuly printed nothing to the file just as I asked it to: [EMAIL PROTECTED]:~/src/ikiwiki>ls -l foo -rw-r--r-- 1 joey joey 0 Feb 20 17:04 foo It seems that what's going on is that perl's print doesn't call any system calls if printing a null string, so the errno from previous system calls hangs around. In this case it's the errno from the earlier ioctl calls (don't know why perl makes those calls). And apparently it sees that errno is set and decides there's an error! So if this is really a bug in perl, and a fixable bug in perl (not one that existing programs rely on somehow), it could be fixed by setting errno=0 before doing anything in perl's print function, or not checking errno if nothing was done. In the meantime, any code that wants to be robust and check its print calls for errors, and that has the potential of printing empty strings sometimes, is left holding the bag and either adding guards around print calls. Which rather sucks, IMHO. -- System Information: Debian Release: 4.0 APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18-4-686 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages perl depends on: ii libc6 2.3.6.ds1-11 GNU C Library: Shared libraries ii libdb4.4 4.4.20-8 Berkeley v4.4 Database Libraries [ ii libgdbm3 1.8.3-3 GNU dbm database routines (runtime ii perl-base 5.8.8-7 The Pathologically Eclectic Rubbis ii perl-modules 5.8.8-7 Core Perl modules Versions of packages perl recommends: ii perl-doc 5.8.8-7 Perl documentation -- no debconf information -- see shy jo
signature.asc
Description: Digital signature