Bug#390079: hdparm: -C option tells fibs when it isn't able to determine the drive status

2006-10-01 Thread Andrew Pollock
On Sun, Oct 01, 2006 at 11:00:23PM +0100, Stephen Gran wrote:
> This one time, at band camp, Andrew Pollock said:
> > On Fri, Sep 29, 2006 at 04:05:58PM +0100, Stephen Gran wrote:
> > > Can you try this patch and see if it reports correct behavior for you?
> > > 
> > > Index: hdparm.c
> 
> [snip]
> 
> > I'll try and rebuilt it tonight and let you know.
> 
> Just a ping - I know it's not a hugely critical bug, but if it fixes the
> problem for you, I wouldn't mind getting it uploaded.  Can you let me
> know?


Sorry for the delay, yes, this patch fixes the problem.

regards

Andrew


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#390079: hdparm: -C option tells fibs when it isn't able to determine the drive status

2006-10-01 Thread Stephen Gran
This one time, at band camp, Andrew Pollock said:
> On Fri, Sep 29, 2006 at 04:05:58PM +0100, Stephen Gran wrote:
> > Can you try this patch and see if it reports correct behavior for you?
> > 
> > Index: hdparm.c

[snip]

> I'll try and rebuilt it tonight and let you know.

Just a ping - I know it's not a hugely critical bug, but if it fixes the
problem for you, I wouldn't mind getting it uploaded.  Can you let me
know?
-- 
 -
|   ,''`.Stephen Gran |
|  : :' :[EMAIL PROTECTED] |
|  `. `'Debian user, admin, and developer |
|`- http://www.debian.org |
 -


signature.asc
Description: Digital signature


Bug#390079: hdparm: -C option tells fibs when it isn't able to determine the drive status

2006-09-29 Thread Mark Lord

Stephen Gran wrote:

--- hdparm.c(revision 113)
+++ hdparm.c(working copy)
@@ -1237,7 +1237,7 @@
unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0};
const char *state;
if (ioctl(fd, HDIO_DRIVE_CMD, &args)
-&& (args[0] == WIN_CHECKPOWERMODE2) /* try again with 0x98 */
+&& (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */
 && ioctl(fd, HDIO_DRIVE_CMD, &args)) {
if (errno != EIO || args[0] != 0 || args[1] != 0)
state = "unknown";

Mark, does this look OK to you?


Yes, looks great.  I wonder when I accidently broke that part.. ?

Cheers
--
Mark Lord
Real-Time Remedies Inc.
[EMAIL PROTECTED]



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#390079: hdparm: -C option tells fibs when it isn't able to determine the drive status

2006-09-29 Thread Andrew Pollock
On Fri, Sep 29, 2006 at 04:05:58PM +0100, Stephen Gran wrote:
> This one time, at band camp, Andrew Pollock said:
> > On Fri, Sep 29, 2006 at 09:32:20AM +0100, Stephen Gran wrote:
> > > This one time, at band camp, Andrew Pollock said:
> > > > Whilst playing around with hdparm -C on some IDE drives connected via 
> > > > IDE-USB adapters, it became apparent that it was reporting standby, when
> > > > it really should have been reporting unknown. This is apparent when
> > > > running hdparm under strace. It gets an ENOTTY back from the ioctl()
> > > > call, and then goes on to report the drive being in a standby state. It
> > > > should, according to the manpage, be reporting "unknown".
> > > 
> > > Can yuo send me the complete strace output?  What you're reporting is
> > > not exactly what I see in the code, so I'd like to look it over.
> > 
> > Attached.
> > 
> > regards
> > 
> > Andrew
> 
> > write(1, "/dev/sda:\n", 10) = 10
> > ioctl(3, 0x31f, 0xafe04e40) = -1 EINVAL (Invalid argument)
> > write(1, " drive state is:  standby\n", 26) = 26
> 
> Ah.  EINVAL makes a whole lot more sense than ENOTTY.  I am going to
> copy upstream on this and see where we get.

I'm pretty sure I was seeing ENOTTY on an ATA over Ethernet block device.
Yeah, I did.
 
> Can you try this patch and see if it reports correct behavior for you?
> 
> Index: hdparm.c
> ===
> --- hdparm.c(revision 113)
> +++ hdparm.c(working copy)
> @@ -1237,7 +1237,7 @@
> unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0};
> const char *state;
> if (ioctl(fd, HDIO_DRIVE_CMD, &args)
> -&& (args[0] == WIN_CHECKPOWERMODE2) /* try again with 0x98 */
> +&& (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */
>  && ioctl(fd, HDIO_DRIVE_CMD, &args)) {
> if (errno != EIO || args[0] != 0 || args[1] != 0)
> state = "unknown";

I'll try and rebuilt it tonight and let you know.

regards

Andrew


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#390079: hdparm: -C option tells fibs when it isn't able to determine the drive status

2006-09-29 Thread Stephen Gran
This one time, at band camp, Andrew Pollock said:
> On Fri, Sep 29, 2006 at 09:32:20AM +0100, Stephen Gran wrote:
> > This one time, at band camp, Andrew Pollock said:
> > > Whilst playing around with hdparm -C on some IDE drives connected via 
> > > IDE-USB adapters, it became apparent that it was reporting standby, when
> > > it really should have been reporting unknown. This is apparent when
> > > running hdparm under strace. It gets an ENOTTY back from the ioctl()
> > > call, and then goes on to report the drive being in a standby state. It
> > > should, according to the manpage, be reporting "unknown".
> > 
> > Can yuo send me the complete strace output?  What you're reporting is
> > not exactly what I see in the code, so I'd like to look it over.
> 
> Attached.
> 
> regards
> 
> Andrew

> write(1, "/dev/sda:\n", 10) = 10
> ioctl(3, 0x31f, 0xafe04e40) = -1 EINVAL (Invalid argument)
> write(1, " drive state is:  standby\n", 26) = 26

Ah.  EINVAL makes a whole lot more sense than ENOTTY.  I am going to
copy upstream on this and see where we get.

Can you try this patch and see if it reports correct behavior for you?

Index: hdparm.c
===
--- hdparm.c(revision 113)
+++ hdparm.c(working copy)
@@ -1237,7 +1237,7 @@
unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0};
const char *state;
if (ioctl(fd, HDIO_DRIVE_CMD, &args)
-&& (args[0] == WIN_CHECKPOWERMODE2) /* try again with 0x98 */
+&& (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */
 && ioctl(fd, HDIO_DRIVE_CMD, &args)) {
if (errno != EIO || args[0] != 0 || args[1] != 0)
state = "unknown";

Mark, does this look OK to you?
-- 
 -
|   ,''`.Stephen Gran |
|  : :' :[EMAIL PROTECTED] |
|  `. `'Debian user, admin, and developer |
|`- http://www.debian.org |
 -


signature.asc
Description: Digital signature


Bug#390079: hdparm: -C option tells fibs when it isn't able to determine the drive status

2006-09-29 Thread Andrew Pollock
On Fri, Sep 29, 2006 at 09:32:20AM +0100, Stephen Gran wrote:
> This one time, at band camp, Andrew Pollock said:
> > Whilst playing around with hdparm -C on some IDE drives connected via 
> > IDE-USB adapters, it became apparent that it was reporting standby, when
> > it really should have been reporting unknown. This is apparent when
> > running hdparm under strace. It gets an ENOTTY back from the ioctl()
> > call, and then goes on to report the drive being in a standby state. It
> > should, according to the manpage, be reporting "unknown".
> 
> Can yuo send me the complete strace output?  What you're reporting is
> not exactly what I see in the code, so I'd like to look it over.

Attached.

regards

Andrew
execve("/sbin/hdparm", ["hdparm", "-C", "/dev/sda"], [/* 13 vars */]) = 0
uname({sys="Linux", node="minotaur", ...}) = 0
brk(0)  = 0x8057000
access("/etc/ld.so.nohwcap", F_OK)  = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xa7ef5000
access("/etc/ld.so.preload", R_OK)  = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xa7ef4000
open("/etc/ld.so.cache", O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=24754, ...}) = 0
mmap2(NULL, 24754, PROT_READ, MAP_PRIVATE, 3, 0) = 0xa7eed000
close(3)= 0
access("/etc/ld.so.nohwcap", F_OK)  = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260O\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1279120, ...}) = 0
mmap2(NULL, 1289180, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0xa7db2000
mmap2(0xa7ee3000, 32768, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x130) = 0xa7ee3000
mmap2(0xa7eeb000, 7132, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xa7eeb000
close(3)= 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xa7db1000
mprotect(0xa7ee3000, 20480, PROT_READ)  = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0xa7db16c0, limit:1048575, 
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, 
useable:1}) = 0
munmap(0xa7eed000, 24754)   = 0
open("/dev/sda", O_RDONLY|O_NONBLOCK)   = 3
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xa7ef3000
write(1, "\n", 1)   = 1
write(1, "/dev/sda:\n", 10) = 10
ioctl(3, 0x31f, 0xafe04e40) = -1 EINVAL (Invalid argument)
write(1, " drive state is:  standby\n", 26) = 26
close(3)= 0
munmap(0xa7ef3000, 4096)= 0
exit_group(0)   = ?


Bug#390079: hdparm: -C option tells fibs when it isn't able to determine the drive status

2006-09-29 Thread Stephen Gran
This one time, at band camp, Andrew Pollock said:
> Whilst playing around with hdparm -C on some IDE drives connected via 
> IDE-USB adapters, it became apparent that it was reporting standby, when
> it really should have been reporting unknown. This is apparent when
> running hdparm under strace. It gets an ENOTTY back from the ioctl()
> call, and then goes on to report the drive being in a standby state. It
> should, according to the manpage, be reporting "unknown".

Can yuo send me the complete strace output?  What you're reporting is
not exactly what I see in the code, so I'd like to look it over.

Thanks,
-- 
 -
|   ,''`.Stephen Gran |
|  : :' :[EMAIL PROTECTED] |
|  `. `'Debian user, admin, and developer |
|`- http://www.debian.org |
 -


signature.asc
Description: Digital signature


Bug#390079: hdparm: -C option tells fibs when it isn't able to determine the drive status

2006-09-28 Thread Andrew Pollock
Package: hdparm
Version: 6.6-1
Severity: normal

Hi,

Whilst playing around with hdparm -C on some IDE drives connected via 
IDE-USB adapters, it became apparent that it was reporting standby, when
it really should have been reporting unknown. This is apparent when
running hdparm under strace. It gets an ENOTTY back from the ioctl()
call, and then goes on to report the drive being in a standby state. It
should, according to the manpage, be reporting "unknown".

regards

Andrew

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-686
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)

Versions of packages hdparm depends on:
ii  libc6 2.3.6-15   GNU C Library: Shared libraries
ii  lsb-base  3.0-15 Linux Standard Base 3.0 init scrip

hdparm recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]