Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 142070 - sys-fs/e2fsprogs - mke2fs, e2fsck, mkdosfs fail on Compact Flash cards connected via internal IDE Interface
Summary: sys-fs/e2fsprogs - mke2fs, e2fsck, mkdosfs fail on Compact Flash cards conne...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-29 03:07 UTC by Qing-JIe Zhou
Modified: 2006-07-30 17:12 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
sys-fs/e2fsprogs bug 142070 compact flash cards via IDE (e2fsprogs-1.38-compact-flash.patch,1.18 KB, patch)
2006-07-29 03:20 UTC, Qing-JIe Zhou
Details | Diff
sys-fs/dosfstools bug 142070 compact flash card via IDE (dosfstools-2.11-compact-flash.patch,421 bytes, patch)
2006-07-29 03:21 UTC, Qing-JIe Zhou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Qing-JIe Zhou 2006-07-29 03:07:14 UTC
mke2fs, e2fsck, mkdosfs fail on Compact Flash cards if they are connected via  internal IDE interface. But they will run ok on same cards if connected via external USB card-reader.

mke2fs, e2fsck, mkdosfs will report "Unable to open device" right after check_mount(). After check_mount(), they will fd = open("/dev/hdc", O_RDWR), it will return fd=-1 and errno=2.

I suggest a solution by adding usleep(500000) after check_mount(). It works on my computer and SanDisk 512MB card connected via IDE. I have give several patches here.

patches are here


cat e2fsprogs-1.38-r2.ebuild.patch

--- /usr/portage/sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild	2006-04-24 09:39:19.000000000 +0800
+++ /usr/portage/sys-fs/e2fsprogs/e2fsprogs-1.38-r2.ebuild	2006-07-25 14:42:07.000000000 +0800
@@ -53,6 +53,9 @@
 	# Fixes libintl handling on non-glibc #122368
 	epatch "${FILESDIR}/${P}-libintl.patch"
 
+	# Fixes compact flash support
+	epatch "${FILESDIR}/${P}-compact-flash.patch"
+
 	# kernel headers use the same defines as e2fsprogs and can cause issues #48829
 	sed -i \
 		-e 's:CONFIG_JBD_DEBUG:__CONFIG_JBD_DEBUG__E2FS:g' \


cat e2fsprogs-1.38-compact-flash.patch

--- e2fsprogs-1.38/misc/util.c	2005-06-06 04:05:22.000000000 +0800
+++ e2fsprogs-1.38/misc/util.c	2006-07-25 14:37:22.000000000 +0800
@@ -146,6 +146,7 @@
 	int		mount_flags;
 
 	retval = ext2fs_check_if_mounted(device, &mount_flags);
+	usleep(500000);
 	if (retval) {
 		com_err("ext2fs_check_if_mount", retval,
 			_("while determining whether %s is mounted."),

--- e2fsprogs-1.38/misc/mke2fs.c	2005-07-01 08:00:40.000000000 +0800
+++ e2fsprogs-1.38/misc/mke2fs.c	2006-07-29 14:00:20.000000000 +0800
@@ -1316,6 +1316,7 @@
 		param.s_first_meta_bg = atoi(tmp);
 
 	/* Get the hardware sector size, if available */
+	usleep(500000);
 	retval = ext2fs_get_device_sectsize(device_name, &sector_size);
 	if (retval) {
 		com_err(program_name, retval,
@@ -1417,6 +1418,7 @@
 	/*
 	 * Initialize the superblock....
 	 */
+	usleep(500000);
 	retval = ext2fs_initialize(device_name, 0, &param,
 				   io_ptr, &fs);
 	if (retval) {

--- e2fsprogs-1.38/e2fsck/unix.c	2006-07-29 13:44:37.000000000 +0800
+++ e2fsprogs-1.38/e2fsck/unix.c	2006-07-29 14:12:25.000000000 +0800
@@ -861,6 +861,7 @@
 	}
 	
 	check_mount(ctx);
+	usleep(500000);
 	
 	if (!(ctx->options & E2F_OPT_PREEN) &&
 	    !(ctx->options & E2F_OPT_NO) &&


cat dosfstools-2.11-r2.ebuild.patch

--- /usr/portage/sys-fs/dosfstools/dosfstools-2.11.ebuild	2006-06-17 05:06:24.000000000 +0800
+++ dosfstools-2.11-r2.ebuild	2006-07-29 17:59:53.000000000 +0800
@@ -2,6 +2,8 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/sys-fs/dosfstools/dosfstools-2.11.ebuild,v 1.4 2006/06/16 20:42:01 corsair Exp $
 
+inherit eutils
+
 DESCRIPTION="DOS filesystem tools - provides mkdosfs, mkfs.msdos, mkfs.vfat"
 HOMEPAGE="ftp://ftp.uni-erlangen.de/pub/Linux/LOCAL/dosfstools/"
 SRC_URI="ftp://ftp.uni-erlangen.de/pub/Linux/LOCAL/dosfstools/${P}.src.tar.gz"
@@ -16,6 +18,8 @@
 src_unpack() {
 	unpack ${A}
 	cd "${S}"
+	epatch "${FILESDIR}/${P}-compact-flash.patch"
+
 	sed -i \
 		-e '/^PREFIX/s:=:=/usr:' \
 		-e '/^MANDIR/s:/usr:/share:' \


cat dosfstools-2.11-compact-flash.patch

--- dosfstools-2.11/mkdosfs/mkdosfs.c	2005-03-13 00:12:16.000000000 +0800
+++ dosfstools-2.11/mkdosfs/mkdosfs.c	2006-07-25 22:56:53.000000000 +0800
@@ -1669,6 +1669,7 @@
 
   if (!create) {
     check_mount (device_name);	/* Is the device already mounted? */
+    usleep(500000);
     dev = open (device_name, O_RDWR);	/* Is it a suitable device to build the FS on? */
     if (dev < 0)
       die ("unable to open %s");


emerge --info goes here

Portage 2.1-r1 (default-linux/x86/2006.0, gcc-3.4.6, glibc-2.3.6-r4, 2.6.17-gentoo-r4 i686)
=================================================================
System uname: 2.6.17-gentoo-r4 i686 Intel(R) Pentium(R) D  CPU 2.66GHz
Gentoo Base System version 1.6.15
app-admin/eselect-compiler: [Not Present]
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.13-r3
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=pentium4 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LC_ALL="en_US.UTF-8"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 acpi adns bcmath big-tables bzip2 caps cdr cgi chroot cjk cli crypt ctype curl cvsgraph dba dhcp discard-path dlloader elibc_glibc ethereal exif expat fam fastcgi fbcon force-cgi-redirect gd gdbm gif gmp iconv idn inode jpeg kernel_linux libwww livecd lm_sensors logrotate lua memcache memlimit mhash ming minimal mmx mysql mysqli ncurses nptl overload pam pcntl pcre pdflib php png posix pppd readline reflection rrdtool sensord server session sftplogging sharedmem simplexml snmp soap sockets spl sqlite sse sse2 ssl symlink sysvipc tokenizer truetype udev unicode userland_GNU userlocales wddx webdav xattr xml xml2 xmlrpc xsl zlib input_devices_keyboard input_devices_mouse input_devices_evdev"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Qing-JIe Zhou 2006-07-29 03:20:38 UTC
Created attachment 92990 [details, diff]
sys-fs/e2fsprogs bug 142070 compact flash cards via IDE
Comment 2 Qing-JIe Zhou 2006-07-29 03:21:25 UTC
Created attachment 92991 [details, diff]
sys-fs/dosfstools bug 142070 compact flash card via IDE
Comment 3 SpanKY gentoo-dev 2006-07-30 17:12:32 UTC
not a chance will calls to usleep() be added