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

Bug#403891: linux-kbuild-2.6.18: modpost fails when there are no object files provided in the command line



Package: linux-kbuild-2.6.18
Version: 2.6.18-1
Severity: important

I'm building proprietary Linux module with complicated directory structure.
Particulary, ther is a directory with a library being built inside it 
(i.e. lib-y is non-empty, obj-y is empty). Linux kernel Makefile runs
modpost regardless of emptyness of obj-y variable; so I see the following
command being run:

  scripts/mod/modpost -m  -i /usr/src/linux-headers-2.6.18-3-amd64/Module.symvers -I /<path_to_the_library_dir>/Module.symvers -o /<path_to_the_library_dir>/Module.symvers

I do not have any problems with it when I use self-compiled kernels (even
when I compile them with kernel-package) or with RH kernels. However, when
I use kernels from the Debian etch, such as linux-image-2.6.18-3-amd64
with linux-headers-2.6.18-3-amd64, the modpost command fails with error 
"Can't open file".

modpost command from linux-kbuild-2.6.18 tries to detect the type of the
object and fails to do it when there are no object files passed to it.
I propose to fix Debian modpost script to call any one of the available
real modpost scripts. Another option may be to create an empty file using
the file name specified in the "-o" option and exit (it is the behaviour 
of the real modpost).

A patch for the first approach:

--- /home/sasha/src/linux-kbuild-2.6-2.6.18/src/mod/modpost.c.saved	2006-12-20 14:14:18.000000000 +0300
+++ /home/sasha/src/linux-kbuild-2.6-2.6.18/src/mod/modpost.c	2006-12-20 14:16:47.000000000 +0300
@@ -28,6 +28,12 @@
     }
   }
 
+  if (argv[optind] == NULL)
+  {
+    data = "lsb";
+    class = "64";
+    goto done;
+  }
   if (!(file = fopen (argv[optind], "r")))
   {
     fprintf (stderr, "Can't open file\n");
@@ -63,6 +69,7 @@
     default:
       return 1;
   }
+done:
   snprintf (prog, sizeof prog, "%s.real-%s-%s", argv[0], data, class);
 
   return execv (prog, argv);


A patch for the second approach:

--- /home/sasha/src/linux-kbuild-2.6-2.6.18/src/mod/modpost.c.saved	2006-12-20 14:14:18.000000000 +0300
+++ /home/sasha/src/linux-kbuild-2.6-2.6.18/src/mod/modpost.c	2006-12-20 14:24:24.000000000 +0300
@@ -12,6 +12,7 @@
   unsigned char ei[EI_NIDENT];
   int opt;
   FILE *file;
+  char *out_file;
 
   while ((opt = getopt (argc, argv, "ai:I:mo:")) != -1)
   { 
@@ -22,12 +23,19 @@
       case 'I':
       case 'm':
       case 'o':
+        out_file = optarg;
         break;
       default:
         return 1;
     }
   }
 
+  if (argv[optind] == NULL)
+  {
+    file = fopen(out_file, "w");
+    fclose(file);
+    return 0;
+  }
   if (!(file = fopen (argv[optind], "r")))
   {
     fprintf (stderr, "Can't open file\n");

Thank you for your work,
in hope that this bug will be fixed before Etch,
    Alexandra.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (900, 'testing'), (50, 'experimental'), (50, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-amd64
Locale: LANG=, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)

Versions of packages linux-kbuild-2.6.18 depends on:
ii  libc6                        2.3.6.ds1-8 GNU C Library: Shared libraries

linux-kbuild-2.6.18 recommends no packages.

-- no debconf information

-- 
Regards,
        Sasha.
Alexandra N. Kossovsky, software engineer.
e-mail: sasha@sanechka.spb.ru



Reply to: