[Bug 171111] (libperl) could not run system-config-printer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug report.

Summary: (libperl) could not run system-config-printer


https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=171111


jvdias@xxxxxxxxxx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Additional Comments From jvdias@xxxxxxxxxx  2005-10-24 16:49 EST -------
OK, it appears this command has caused a SIGSEGV when run with STDIN 
directed a USB printer device:

# perl -e 'ioctl(STDIN,0x84005001,$result); print $result' </dev/usb/lp0

from:
/usr/share/printconf/util/printconf_conf.py, @ line 1460:
	magic_perl = "perl -e 'ioctl(STDIN,0x84005001,$result);"
	magic_perl += "print $result' 2>/dev/null <"
	foo = os.popen (magic_perl + dev)
	rawid = foo.readlines ()

Why not use the Python fcntl.ioctl() call here ?

It would be interesting to see if python also has a problem with this ioctl:

# python
>>> import os, fcntl, array;
>>> result=array.array(1024) 
>>> fcntl.ioctl( os.open("/dev/usb/lp0","r"), -2080354303, result, 1 )
  
I've just now tried running the perl command above with STDIN directed to an
RS-232 serial port, (the only serial device I have here at work) on up-to-date
Rawhide, FC-4, RHEL-4 and FC-3 systems, and have not been able to reproduce
the problem. 

I do have a USB printer at home, and I try to reproduce this problem there.

But googling for 0x84005001 turned up 

http://home.techwiz.ca/ftp/Linux/dist/MandrakeLinux/official/9.2/i586/Mandrake/mdkinst/usr/bin/perl-install/printer/detect.pm.gz
:
	    # Calculation of IOCTL function 0x84005001 (to get device ID
	    # string):
	    # len = 1024
	    # IOCNR_GET_DEVICE_ID = 1
	    # LPIOC_GET_DEVICE_ID(len) =
	    #     _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
	    # _IOC(), _IOC_READ as defined in /usr/include/asm/ioctl.h
	    # Use "eval" so that program does not stop when IOCTL fails
	    eval { 
		my $output = "\0" x 1024; 
		ioctl($PORT, 0x84005001, $output);
		$idstr = $output;
	    } or do {
		close $PORT;
		next;
	    };

Note how the programmer is careful to allocate a 1024 buffer for the RW
ioctl $output parameter, since the 0x84005001 says "I am passing in 
an 1024 byte RW buffer" .

Perhaps the SEGV occurs only when a USB printer is on STDIN, because 
only a USB printer actually returns an ID string, which writes into the 
(empty) $result buffer ?

Does the problem still occur if the command is ammended :

perl -e '$result="\0" x 1024; ioctl(STDIN,0x84005001,$result);print
$result,"\n";' </dev/usb/lp0

If not, I don't think it this a PERL bug , but a programming error - any 
use of ioctl(x,0x84005001,buf), invoked from a C program, will cause a 
SIGSEGV if the ioctl returns data in buf and buf does not point to a 1024 byte
buffer .

Can anyone reading this with access to a USB printer please verify, with 
latest versions that this is still a bug:

1. Does this command produces a SIGSEGV:
# perl -e 'ioctl(STDIN,0x84005001,$result); print $result' </dev/usb/lp0

2. Does this command produce a SIGSEGV :
# perl -e '$result="\0" x 1024; ioctl(STDIN,0x84005001,$result); print $result'
</dev/usb/lp0

If the answer to (2) is NO, then this is not a PERL bug.


-- 
Configure bugmail: https://bugzilla.redhat.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux