Bug#338228: yaird error: unrecognised line in /proc/bus/input/devices: S: Sysfs=/class/input/input0 (fatal)
On Tue, Nov 08, 2005 at 11:04:23PM +0100, Rutger Nijlunsing wrote:
>
> apt-get dist-upgrade results in (on a fairly recent git kernel):
>
> yaird error: unrecognised line in /proc/bus/input/devices: S: Sysfs=/class/input/input0 (fatal)
Thanks for pointing this out.
Attached three patches:
- patch 96: support DAC960 (recognition works, boot untested)
- patch 97: correct ldd regression #337855
- patch 98: cope with new input format in 2.6.15, tested with 2.6.14-git12.
Regards,
Erik
* added files
{arch}/yaird/yaird--devo/yaird--devo--0.1/ekonijn@xs4all.nl--debian/patch-log/patch-96
* modified files
--- orig/ChangeLog
+++ mod/ChangeLog
@@ -2,6 +2,20 @@
# arch-tag: automatic-ChangeLog--ekonijn@xs4all.nl--debian/yaird--devo--0.1
#
+2005-11-09 14:12:07 GMT Erik van Konijnenburg <ekonijn@xs4all.nl> patch-96
+
+ Summary:
+ pre 0.0.12
+ Revision:
+ yaird--devo--0.1--patch-96
+
+ * Add DAC960 recognition.
+ * Add todo stuff
+
+ modified files:
+ ChangeLog TODO perl/Plan.pm
+
+
2005-11-03 06:02:57 GMT Erik van Konijnenburg <ekonijn@xs4all.nl> patch-95
Summary:
--- orig/TODO
+++ mod/TODO
@@ -1,4 +1,6 @@
Todo:
+ - regression: ldd for dynamic executables fails, eg ldconfig.
+ - consider $TMPDIR, umask for output.
- what if sda,sdb are raid, then a new disk is added,
and the raid is sda,sdc? we need something like coldplug.
- what about fbcon?
--- orig/perl/Plan.pm
+++ mod/perl/Plan.pm
@@ -447,6 +447,13 @@
return 1;
}
+ # similar driver
+ if ($name =~ /^rd!c\d+d\d+$/) {
+ ModProbe::addModules ($actions, [ "DAC960" ]);
+ $actions->add("mkbdev", $device->yspecial, sysname => $name);
+ return 1;
+ }
+
return 0;
}
* added files
{arch}/yaird/yaird--devo/yaird--devo--0.1/ekonijn@xs4all.nl--debian/patch-log/patch-97
* modified files
--- orig/ChangeLog
+++ mod/ChangeLog
@@ -2,6 +2,24 @@
# arch-tag: automatic-ChangeLog--ekonijn@xs4all.nl--debian/yaird--devo--0.1
#
+2005-11-09 20:46:57 GMT Erik van Konijnenburg <ekonijn@xs4all.nl> patch-97
+
+ Summary:
+ pre-0.0.12
+ Revision:
+ yaird--devo--0.1--patch-97
+
+ * Replace all the variants for getting output from a command
+ with a unified routine.
+ * For ldd, restore the behaviour that non-zero exit is expected
+ if it's not a dynamic executable.
+ This should fix debian bug #337855
+
+ modified files:
+ ChangeLog TODO perl/Base.pm perl/LvmTab.pm perl/ModProbe.pm
+ perl/Plan.pm perl/RaidTab.pm perl/SharedLibraries.pm
+
+
2005-11-09 14:12:07 GMT Erik van Konijnenburg <ekonijn@xs4all.nl> patch-96
Summary:
--- orig/TODO
+++ mod/TODO
@@ -1,5 +1,4 @@
Todo:
- - regression: ldd for dynamic executables fails, eg ldconfig.
- consider $TMPDIR, umask for output.
- what if sda,sdb are raid, then a new disk is added,
and the raid is sda,sdc? we need something like coldplug.
--- orig/perl/Base.pm
+++ mod/perl/Base.pm
@@ -152,119 +152,115 @@
#
-# tryGetOutput -- all chomped lines of output for a given command.
-# The twist is that errors are acceptable and result in returning undef.
-# Discard stderr.
-#
-sub tryGetOutput {
- my ($cmd, @args) = @_;
- my $cmdLine = join (' ', $cmd, @args);
-
- my $in;
- my $result;
- if (! -e $cmd) {
- Base::debug ("tryGetOutput - no command $cmd, returning undef");
- return undef;
- }
-
- my $rc = open ($in, "-|");
-
- if (! defined ($rc)) {
- # Failure to fork is not the kind of error we're
- # prepared to ignore.
- Base::fatal ("Can't start command $cmdLine");
- }
-
- elsif ($rc == 0) {
- # Child - setup stderr and exec or fatal.
- $rc = open (STDERR, '>', '/dev/null');
- if (! $rc) {
- exit (1);
+# runCmd -- run a command, return result code plus chomped output lines.
+# Result code is false if something went wrong; it's *not* child exit code.
+# Uses named arguments:
+# missingOk => absent executable non-fatal, result & output will be undef
+# failOk => don't fatal on non-zero exit code
+# keepStderr => do not discard stderr of command.
+# cmd => what to do, including args.
+#
+# Note that some errors (like failure to fork) are fatal even
+# if failOk is set.
+#
+sub runCmd {
+ my %args = @_;
+
+ #
+ # Decode the argument hash.
+ # Sigh, why didn't I do this in python...
+ #
+ my $missingOk = 0;
+ my $failOk = 0;
+ my $keepStderr = 0;
+ my $cmdList = undef;
+ for my $k (keys %args) {
+ if ($k eq 'missingOk') {
+ $missingOk = $args{missingOk};
}
-
- # Do the exec like so to make shell escapes
- # impossible.
- exec { $cmd } $cmd, @args;
-
- # Let parent do the error message.
- exit (1);
- }
- else {
- # parent
- my @lines = <$in>;
- if (! close ($in)) {
- Base::debug ("Could not read output for $cmdLine");
+ elsif ($k eq 'failOk') {
+ $failOk = $args{failOk};
+ }
+ elsif ($k eq 'keepStderr') {
+ $keepStderr = $args{keepStderr};
+ }
+ elsif ($k eq 'cmd') {
+ $cmdList = $args{cmd};
}
else {
- chomp @lines;
- $result = [ @lines ];
+ Base::bug ("unknown argument $k");
}
}
- return $result;
-}
-
-
+ if (! defined ($cmdList)) {
+ Base::bug ('missing argument cmd');
+ }
-#
-# optGetOutput -- all chomped lines of output for a given command.
-# The twist is that a non-existent command is acceptable,
-# and results in returning undef.
-# Errors in invoking the cmd are fatal.
-# Discard stderr.
-#
-sub optGetOutput {
- my ($cmd, @args) = @_;
+ my ($cmd, @args) = @{$cmdList};
my $cmdLine = join (' ', $cmd, @args);
+ Base::debug ("runCmd - doing $cmdLine");
- my $in;
- my $result;
+ #
+ # This is what we'll return
+ #
+ my ($rc, $output) = (undef, undef);
+
+ #
+ # Stuff like vgchange is optional: if not installed,
+ # just return undefs.
+ #
if (! -e $cmd) {
- Base::debug ("No command $cmd, returning undef");
- return undef;
+ if ($missingOk) {
+ Base::debug ("runCmd - command not found: $cmd");
+ return ($rc, $output);
+ }
+ Base::fatal ("command not found: $cmd");
}
- my $rc = open ($in, "-|");
- if (! defined ($rc)) {
- Base::fatal ("Can't start command $cmdLine");
+ #
+ # Fork a new process to run the command
+ #
+ my $in;
+ my $pid = open ($in, "-|");
+ if (! defined ($pid)) {
+ # Failure to fork is not the kind of error we're
+ # prepared to ignore.
+ Base::fatal ("Can't start command $cmd");
}
- elsif ($rc == 0) {
+ elsif ($pid == 0) {
+ #
# Child - setup stderr and exec or fatal.
- $rc = open (STDERR, '>', '/dev/null');
- if (! $rc) {
- exit (1);
+ #
+ if (! $keepStderr) {
+ my $rc = open (STDERR, '>', '/dev/null');
+ if (! $rc) {
+ exit (1);
+ }
}
# Do the exec like so to make shell escapes
# impossible.
exec { $cmd } $cmd, @args;
- # Let parent do the error message.
+ # If can't exec, let parent do the error message.
exit (1);
}
else {
+ #
# parent
+ #
my @lines = <$in>;
- if (! close ($in)) {
+ $rc = close ($in);
+ Base::debug ("runCmd - result '$rc' for $cmdLine");
+ if (! $failOk && ! $rc) {
Base::fatal ("Could not read output for $cmdLine");
}
+
chomp @lines;
- $result = [ @lines ];
+ $output = [ @lines ];
}
- return $result;
-}
-
-# getOutput -- the same, except that command must exist.
-sub getOutput {
- my ($cmd, @args) = @_;
-
- my $result = optGetOutput ($cmd, @args);
- if (! defined ($result)) {
- my $cmdLine = join (' ', $cmd, @args);
- Base::fatal ("Could not execute $cmdLine");
- }
- return $result;
+ return ($rc, $output);
}
--- orig/perl/LvmTab.pm
+++ mod/perl/LvmTab.pm
@@ -126,7 +126,8 @@
#
sub initLvMap () {
$lvMap = {};
- my $lines = Base::optGetOutput ('/sbin/lvdisplay', '-c');
+ my ($rc, $lines) = Base::runCmd (
+ missingOk => 1, cmd => ['/sbin/lvdisplay', '-c']);
if (! defined ($lines)) {
return;
}
@@ -168,7 +169,8 @@
#
sub initVgMap () {
$vgMap = {};
- my $lines = Base::optGetOutput ('/sbin/vgdisplay', '-c');
+ my ($rc, $lines) = Base::runCmd (
+ missingOk => 1, cmd => ['/sbin/vgdisplay', '-c']);
if (! defined ($lines)) {
return;
}
@@ -203,7 +205,8 @@
#
sub initPvMap () {
$pvMap = {};
- my $lines = Base::optGetOutput ('/sbin/pvdisplay', '-c');
+ my ($rc, $lines) = Base::runCmd (
+ missingOk => 1, cmd => ['/sbin/pvdisplay', '-c']);
if (! defined ($lines)) {
return;
}
--- orig/perl/ModProbe.pm
+++ mod/perl/ModProbe.pm
@@ -128,19 +128,15 @@
my ($actionList, $m, $optional) = @_;
my $v = Conf::get('version');
Base::debug ("addOneModule: modprobe $m");
-
- my $lines;
- if ($optional) {
- $lines = Base::tryGetOutput ('/sbin/modprobe', '-v', '-n',
- '--show-depends', '--set-version', $v, $m);
- if (!defined ($lines)) {
- return;
- }
- }
- else {
- $lines = Base::getOutput ('/sbin/modprobe', '-v', '-n',
- '--show-depends', '--set-version', $v, $m);
+ my ($rc, $lines) = Base::runCmd (
+ failOk => $optional,
+ cmd => ['/sbin/modprobe', '-v', '-n',
+ '--show-depends', '--set-version', $v, $m]);
+
+ if (! $rc) {
+ # modprobe failed; assume it's because of not found
+ return;
}
for my $line (@{$lines}) {
--- orig/perl/Plan.pm
+++ mod/perl/Plan.pm
@@ -561,7 +561,8 @@
#
# Let's guess the fstype using /sbin/blkid.
#
- my $guess = Base::optGetOutput ('/sbin/blkid', $rootDevName);
+ my ($rc, $guess) = Base::runCmd (missingOk => 1,
+ cmd => ['/sbin/blkid', $rootDevName]);
if (!defined ($guess)) {
my $origin = $root->origin;
Base::fatal ("the command /sbin/blkid is not found, so file system type 'auto' for '$rootDevName' is not supported; use an explicit file system type ($origin)");
--- orig/perl/RaidTab.pm
+++ mod/perl/RaidTab.pm
@@ -76,7 +76,8 @@
$raidTab = [];
- my $lines = Base::optGetOutput ('/sbin/mdadm', '--detail', '--scan');
+ my ($rc, $lines) = Base::runCmd (missingOk => 1,
+ cmd => ['/sbin/mdadm', '--detail', '--scan']);
if (! defined ($lines)) {
return;
}
@@ -91,8 +92,10 @@
# output, but without the devices part,
# lets retry.
# Note: don't be deceived by the num-devices=... clause.
- $lines = joinStanzas (Base::getOutput
- ('/sbin/mdadm', '--detail', '--scan', '--verbose'));
+ ($rc, $lines) = Base::runCmd (cmd =>
+ ['/sbin/mdadm', '--detail', '--scan', '--verbose']);
+
+ $lines = joinStanzas ($lines);
}
for my $line (@{$lines}) {
--- orig/perl/SharedLibraries.pm
+++ mod/perl/SharedLibraries.pm
@@ -55,7 +55,9 @@
}
# </blech>
- my $lines = Base::getOutput ('/usr/bin/ldd', $executable);
+ my ($rc, $lines) = Base::runCmd (
+ failOk => 1,
+ cmd => ['/usr/bin/ldd', $executable]);
for my $line (@{$lines}) {
last if ($line =~ /statically linked/);
if ($line =~ /not a dynamic executable/) {
@@ -100,6 +102,15 @@
Base::fatal ("unexpected ldd output for $executable: $line");
}
}
+ if (! $rc) {
+ #
+ # Tricky this. If it's not a dynamic executable,
+ # ldd fails, but we invoke findlibr and return
+ # before we get here. Other ldd failures are
+ # unexpected and should abort building the image.
+ #
+ Base::fatal ("ldd failed for $executable");
+ }
return $result;
}
@@ -118,7 +129,8 @@
my $result = [];
my $auxDir = Conf::get ('auxDir');
- my $lines = Base::getOutput ("$auxDir/findlibs", '-q', $executable);
+ my ($rc, $lines) = Base::runCmd (
+ cmd => ["$auxDir/findlibs", '-q', $executable]);
for my $line (@{$lines}) {
if ($line =~ /^interpreter: ([\w.\/-]+)$/) {
push @{$result}, $1;
* added files
{arch}/yaird/yaird--devo/yaird--devo--0.1/ekonijn@xs4all.nl--debian/patch-log/patch-98
* modified files
--- orig/ChangeLog
+++ mod/ChangeLog
@@ -2,6 +2,21 @@
# arch-tag: automatic-ChangeLog--ekonijn@xs4all.nl--debian/yaird--devo--0.1
#
+2005-11-09 22:57:06 GMT Erik van Konijnenburg <ekonijn@xs4all.nl> patch-98
+
+ Summary:
+ 0.0.12 pre
+ Revision:
+ yaird--devo--0.1--patch-98
+
+ * Accept format from /proc/bus/input/devices in 2.6.15,
+ the new input system.
+ This should fix debian bug 338228
+
+ modified files:
+ ChangeLog doc/input.xml perl/InputTab.pm
+
+
2005-11-09 20:46:57 GMT Erik van Konijnenburg <ekonijn@xs4all.nl> patch-97
Summary:
--- orig/doc/input.xml
+++ mod/doc/input.xml
@@ -109,6 +109,30 @@
<listitem>
<para>
+ In kernel 2.6.15, <filename>/sys/class/input</filename>
+ is far more complete. It has links from class device to
+ hardware devices, and hardware devices such as atkbd and
+ psmouse have a 'modalias' file that can be fed to modprobe.
+ This contains everything that's in
+ <filename>/proc/bus/input/devices</filename>,
+ in a nice accessible manner.
+ </para>
+
+ <para>
+ As an aside, can we do all device probing based on the
+ modalias file? This would mean we no longer would have
+ to distinguish between sysfs format for usb and pci,
+ making the code simpler. The tricky part is to distinguish
+ between modules compiled in and modules simply missing from
+ the kernel: dealing with "FATAL: Module ... not found".
+ As a first step, we could simply assume that aliases that cannot
+ be resolved refer to compiled in modules; this is in essence
+ what the current scan of eg modules.usbmap does.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
In <filename>/boot/menu/grub.lst</filename>, kernel options
can be defined that determine whether to use a serial line as
console and whether to use a frame buffer. The consequence
--- orig/perl/InputTab.pm
+++ mod/perl/InputTab.pm
@@ -18,6 +18,13 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
#
+# Note that kernel 2.6.15 will get a /sys interface for input that
+# supplies all the info also available in /proc/bus/input/devices;
+# in particular, /sys/class/input/input0/device is a symlink
+# to a device such as platform/i8042/serio0, that have a modalias
+# that could be probed against. (tested with 2.6.14-git12)
+# For now we make sure we recognise and skip lines describing this in /proc.
+#
use strict;
use warnings;
@@ -59,6 +66,10 @@
$work->{handlers}{$h}++;
}
}
+ elsif ($line =~ /^S: Sysfs=(.*)$/) {
+ # Do not keep track of this.
+ # $work->{sysfs} = $1;
+ }
elsif ($line =~ /^B: ([A-Z]+)=(.*)$/) {
$work->{capabilities}{$1} = $2;
}
Reply to: