Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 103202 - sys-apps/hdparm-5.9 requires removable media be present on non-devfs systems
Summary: sys-apps/hdparm-5.9 requires removable media be present on non-devfs systems
Status: RESOLVED DUPLICATE of bug 69284
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-20 19:33 UTC by Philip Kovacs
Modified: 2005-08-23 09:11 UTC (History)
2 users (show)

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


Attachments
/usr/portage/sys-apps/hdparm/files/hdparm-init-7.diff (diff.hdparm,396 bytes, text/plain)
2005-08-20 19:37 UTC, Philip Kovacs
Details
sys-apps/hdparm/files/hdparm-init-7.diff (x,429 bytes, patch)
2005-08-20 19:49 UTC, Philip Kovacs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Kovacs 2005-08-20 19:33:28 UTC
On non-devfs systems, esp. on systems running >= udev-065 where devfs names are
being removed in favor of LSB names, the script /etc/init.d/hdparm tries to open
block devices as a prerequisite to running hdparm against the device.   This
attempt to open the device fails on removeable-media block devices unless the
media is in the drive.  Specifically:

/etc/init.d/hdparm:
...
else

                # non-devfs compatible system
                for device in /dev/hd?
                do
                        # check that the block device really exists
                        # by opening it for reading
                        if [ -b $device ] && ( : <$device ) 2>/dev/null
                        then
                                eval args=\${`basename $device`_args}
                                do_hdparm
                        fi
                done

        fi
}
---end---

The conditional:

if [ -b $device ] && ( : <$device ) 2>/dev/null

will fail on block devices such as cdroms unless there is media in the drive.
There is no need to try and open the device on udev systems where devices are
created at boot (as opposed to from a tarball), since the creation of the device
node is only done as needed.  The existence of the device node ought to be
considered "enough" to warrant running hdparm against it.

The above conditional should be replaced with:

if [ -b $device ]

to fix the problem.   I will attach a patch to fix hdparm/files/hdparm-init-7

Phil


Reproducible: Always
Steps to Reproduce:
1.create /etc/conf.d/hdparm entries for removable block devices, e.g. to turn on
DMA on a cdrom: hdc_args="-d1"
2.use >=udev-065 with no device tarballs
3. reboot and observe that hdparm will not run against hdc unless there's a cd
in the drive

Actual Results:  
hdparm ignores the hdc_args entry in /etc/conf.d/hdparm

Expected Results:  
hdparm should run against the hdc device using the paramaters supplied in
/etc/conf.d/hdparm

Portage 2.0.51.22-r2 (default-linux/x86/2005.0, gcc-3.3.5-20050130,
glibc-2.3.5-r1, 2.6.12-gentoo-r9 i686)
=================================================================
System uname: 2.6.12-gentoo-r9 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.6.13
dev-lang/python:     2.3.5
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -O2 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo ftp://gentoo.mirrors.pair.com
http://gentoo.ccccom.com"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="x86 X alsa avi cdr cups divx4linux dvd dvdr encode fbcon gif gpm gtk gtk2
jpeg mad mikmod mmx mpeg ncurses nls nptl oggvorbis opengl oss perl png python
readline sdl slang spell sse ssl tcpd truetype unicode xml2 xprint xv xvid zlib
userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LDFLAGS, LINGUAS
Comment 1 Philip Kovacs 2005-08-20 19:37:35 UTC
Created attachment 66444 [details]
/usr/portage/sys-apps/hdparm/files/hdparm-init-7.diff

Diff/patch to correct /usr/portage/sys-apps/hdparm/files/hdparm-init-7 in order
to fix this bug.
Comment 2 Philip Kovacs 2005-08-20 19:49:28 UTC
Created attachment 66445 [details, diff]
sys-apps/hdparm/files/hdparm-init-7.diff

note: sys-apps/hdparm/files/hdparm-init-7 is copied to /etc/init.d/hdparm
during emerge hdparm.  my first diff was against the /etc/init.d/hdparm file,
but to correct the problem in portage, the patch should be against
sys-apps/hdparm/files/hdparm-init-7
Comment 3 Philip Kovacs 2005-08-20 20:24:28 UTC
forgot to mention hdparm is in my boot run-level.
Comment 4 Heinrich Wendel (RETIRED) gentoo-dev 2005-08-23 03:30:17 UTC

*** This bug has been marked as a duplicate of 69284 ***
Comment 5 Philip Kovacs 2005-08-23 09:11:31 UTC
no.  this is not a duplicate of that bug!