Package: file
Version: 4.24-2
Severity: normal
Tags: patch

This change in magic.c, introduced between 4.23 and 4.24, caused a
backup job of ours to produce a large number of mysterious messages
saying "couldn't open file".  It took quite some digging to work out
(from find /usr/lib -type f | xargs strings | grep) what was producing
such a message.

@@ -296,10 +297,12 @@
         errno = 0;
         if ((fd = open(inname, flags)) < 0) {
 #ifdef __CYGWIN__
+            /* FIXME: Do this with EXEEXT from autotools */
             char *tmp = alloca(strlen(inname) + 5);
             (void)strcat(strcpy(tmp, inname), ".exe");
             if ((fd = open(tmp, flags)) < 0) {
 #endif
+                fprintf(stderr, "couldn't open file\n");
                 if (info_from_stat(ms, sb.st_mode) == -1)
                     goto done;
                 rv = 0;

I wanted to submit a patch, so I changed the fprintf line to:

fprintf(stderr, "couldn't open file `%s': %s\n", inname,
strerror(errno));

But then I tripped over a regression with file_error_core.
I'll submit that as a separate Debian bug.

Upstream's response to the above moan was (from Christos):

"I just removed the printf, thanks."

So perhaps we could do that in Debian?
I'm happy to wait for upstream.
Really, then, I'm just raising this Debian bug for the benefit of anyone
else baffled by the same error message, so that they might stand a small
chance of getting a relevant google-hit for it.

-- System Information:
Debian Release: lenny/sid
  APT prefers oldstable
  APT policy: (500, 'oldstable'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored:
LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libmagic1 depends on:
ii  libc6                  2.7-11            GNU C Library: Shared
libraries
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library -
runtime

libmagic1 recommends no packages.

Versions of packages file depends on:
ii  libc6                         2.7-11     GNU C Library: Shared
libraries

-- no debconf information
--- magic.c.old 2008-05-16 08:26:22.000000000 -0700
+++ magic.c     2008-05-16 08:26:35.000000000 -0700
@@ -302,7 +302,6 @@
                        (void)strcat(strcpy(tmp, inname), ".exe");
                        if ((fd = open(tmp, flags)) < 0) {
 #endif
-                               fprintf(stderr, "couldn't open file\n");
                                if (info_from_stat(ms, sb.st_mode) == -1)
                                        goto done;
                                rv = 0;

Reply via email to