Bug 126082

Summary: lockdev errs on /dev/input/ttyACM0 (3-component pathname)
Product: [Fedora] Fedora Reporter: John Reiser <jreiser>
Component: lockdevAssignee: Karel Zak <kzak>
Status: CLOSED DUPLICATE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-02-23 11:35:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Reiser 2004-06-15 20:56:03 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
/usr/sbin/lockdev works only for 2-component pathnames
("/dev/something") and does not check for 3-component pathnames such
as /dev/input/ttyACM0.  minicom and other applications expect
"/usr/sbin/lockdev -l /dev/arbitrary/path/name" to work, but it
doesn't, and the error diagnosis is cryptic and/or misleading.  Either
lockdev should work with an arbitrary pathname below /dev, or lockdev
should be verbose and informative about the error, or all applications
that use lockdev should be fixed to detect 3 or more components in a
pathname (and then adapt appropriately.)


Version-Release number of selected component (if applicable):
lockdev-1.0.1-2.3.1

How reproducible:
Always

Steps to Reproduce:
1. strace /usr/sbin/lockdev -l /dev/input/ttyACM0
2.
3.
    

Actual Results:  Doesn't handle the fact that /dev/input/ttyACM0 has 3
components in the pathname.  The "input/" part gets in the way:

stat64("/dev/input/ttyACM0", {st_mode=S_IFCHR|0666,
st_rdev=makedev(166, 0), ...}) = 0
access("/dev/input/ttyACM0", W_OK)      = 0
open("/var/lock/LCK...3355", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat64(3, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xf70ae000
write(3, "      3355\n", 11)            = 11
close(3)                                = 0
munmap(0xf70ae000, 4096)                = 0
creat("/var/lock/LOCKDEV", 0777)        = 3
flock(3, LOCK_EX|LOCK_NB)               = 0
open("/var/lock/LCK..input/ttyACM0", O_RDONLY) = -1 ENOENT (No such
file or directory)
flock(3, LOCK_EX|LOCK_NB)               = 0
open("/var/lock/LCK.166.000", O_RDONLY) = -1 ENOENT (No such file or
directory)
link("/var/lock/LCK...3355", "/var/lock/LCK.166.000") = 0
flock(3, LOCK_EX|LOCK_NB)               = 0
open("/var/lock/LCK.166.000", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0664, st_size=11, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xf70ad000
read(4, "      3355\n", 4096)           = 11
close(4)                                = 0
munmap(0xf70ad000, 4096)                = 0
kill(3355, SIG_0)                       = 0
flock(3, LOCK_EX|LOCK_NB)               = 0
open("/var/lock/LCK...3355", O_RDONLY)  = 4
fstat64(4, {st_mode=S_IFREG|0664, st_size=11, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xf70ac000
read(4, "      3355\n", 4096)           = 11
close(4)                                = 0
munmap(0xf70ac000, 4096)                = 0
kill(3355, SIG_0)                       = 0
flock(3, LOCK_EX|LOCK_NB)               = 0
open("/var/lock/LCK..input/ttyACM0", O_RDONLY) = -1 ENOENT (No such
file or directory)
link("/var/lock/LCK...3355", "/var/lock/LCK..input/ttyACM0") = -1
ENOENT (No such file or directory)
unlink("/var/lock/LCK...3355")          = 0
unlink("/var/lock/LCK.166.000")         = 0
unlink("/var/lock/LOCKDEV")             = 0
close(3)                                = 0
umask(022)                              = 02
exit_group(7)                           = ?


Expected Results:  Work effectively with any /dev/... pathname,
including cases where "..." contains a '/'.  Such as, in the case of
/dev/input/ttyACM0: Create directory /var/lock/input if necessary,
create symlink /var/lock/LCK..input_tyACM0 -> /var/lock/input/ttyACM0,
etc.


Additional info:

Comment 1 Avi Alkalay 2004-09-07 16:13:32 UTC
I had to create the directory /var/lock/LCK..input to make it work.

Comment 2 Karel Zak 2005-02-23 11:35:39 UTC

*** This bug has been marked as a duplicate of 74454 ***