coreutils affected by "Bad file descriptor" error with new glibc on older kernel

Bug #552816 reported by Nathan Stratton Treadway on 2010-03-31
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
coreutils
Fix Released
Unknown
coreutils (Debian)
Fix Released
Unknown
coreutils (Ubuntu)
Medium
Unassigned
Lucid
Medium
Unassigned

Bug Description

Binary package hint: coreutils

After I recently upgraded a virtual machine running linux 2.6.18 to Lucid, I noticed that I was getting some strange errors from coreutils utilities:

  $ mkdir temp
  $ touch temp
  touch: setting times of `temp': Bad file descriptor
  $ cp -pr temp temp2
  cp: preserving times for `temp2': Bad file descriptor

I found an explaination for these errors in Debug bug report 563754 (and related bugs): a recent change to the libc6 library (included in the Lucid version) corrected a bug in the behavior of the "futimens" function when running on older kernels, which in turn exposed a bug in the gnulib library, and that in turn causes these errors when using various coreutils binaries.

One fix for this would be to upgrade to coreutils 8.3 (or later). The release notes for 8.3 include this entry:
  cp -p, install -p, mv, and touch -c could trigger a spurious error
  message when using new glibc coupled with an old kernel.
  [bug introduced in coreutils-6.12].

For a more target fix, it may be possible just to apply the upstream gnulib patch to the existing Lucid coreutils package:
  http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=41c44a66101c6c14b4e7f151247d517579760ba9

Here's a link to the bug-coreutils thread on the topic:
  http://lists.gnu.org/archive/html/bug-coreutils/2010-01/msg00042.html

and the (overlapping) thread on the bug-gnulib list:
  http://lists.gnu.org/archive/html/bug-gnulib/2010-01/msg00044.html

(For what it's worth, I found two LP bugs which report this same gnulib bug as it applies to the "tar" command: bug #503109 and bug #539814 ; they also list a few different situation that have caused people to want to run Lucid-release packages using older kernel versions...)

Changed in coreutils:
status: Unknown → Fix Released

I was just trying another test upgrade on the same virtual machine (from karmic to lucid).

This time, the coreutils/gnulib bug actually caused the upgrade process to abort, after dpkg printed these line:
==========
Setting up slapd (2.4.21-0ubuntu3) ...
Installing new version of config file /etc/ldap/schema/ldapns.schema ...
Installing new version of config file /etc/apparmor.d/usr.sbin.slapd ...
  Backing up /etc/ldap/slapd.d/ in /var/backups/slapd-2.4.18-0ubuntu1... cp: preserving times for `/var/backups/slapd-2.4.18-0ubuntu1/slapd.d/cn=config/cn=schema': Bad file descriptor
cp: preserving times for `/var/backups/slapd-2.4.18-0ubuntu1/slapd.d/cn=config': Bad file descriptor
cp: preserving times for `/var/backups/slapd-2.4.18-0ubuntu1/slapd.d': Bad file descriptor
dpkg: error processing slapd (--configure):
 subprocess installed post-installation script returned error exit status 1
===============

(Note that the three paths mentioned in the error messages all refer to directories.)

I was able to get slapd to install/configure successfully by extracting the /bin/tar binary out of the Debian Squeeze coreutils 8.4 package, installing it into /bin on my test system, and then running "dpkg --configure --pending"...

(Sorry, obviously it was /bin/cp that I extracted out of the coreutils package, not /bin/tar....)

Changed in coreutils (Debian):
status: Unknown → Fix Released
Matthias Klose (doko) wrote :

fixed in maverick, uploaded for lucid-proposed, waiting for approval

Changed in coreutils (Ubuntu Lucid):
importance: Undecided → Medium
status: New → Fix Released
status: Fix Released → In Progress
Changed in coreutils (Ubuntu):
importance: Undecided → Medium
status: New → Fix Released

Accepted coreutils into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in coreutils (Ubuntu Lucid):
status: In Progress → Fix Committed
tags: added: verification-needed
Simon Déziel (sdeziel) wrote :

I have _not_ tested on an old kernel but using 2.6.35 from Maverick on Lucid does not have any visible regressions.

$ lsb_release -rd
Description: Ubuntu 10.04.1 LTS
Release: 10.04

$ uname -a
Linux simon-laptop 2.6.35-22-generic #33~lucid1-Ubuntu SMP Sat Sep 18 12:23:52 UTC 2010 x86_64 GNU/Linux

Jean-Baptiste Lallement (jibel) wrote :

SRU verification for Lucid:
I have reproduced the problem with coreutils 7.4-2ubuntu2 in lucid and have verified that the version of coreutils 7.4-2ubuntu3 in -proposed fixes the issue. I've found no regression when using this package on lucid.

Marking as verification-done

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package coreutils - 7.4-2ubuntu3

---------------
coreutils (7.4-2ubuntu3) lucid-proposed; urgency=low

  * Fix "Bad file descriptor" message from cp & touch (ensure that futimens
    is only called with a valid file descriptor). LP: #552816.
 -- Matthias Klose <email address hidden> Mon, 20 Sep 2010 18:57:13 +0200

Changed in coreutils (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.