Skip to contentSkip to conversation

2.4.0-test10 truncate() change broke `dd'

DISCUSSION Mikael Pettersson 3 participants 3 messages Nov 16, 2000

lore
Share & tools
lore
#0 lore raw
Quoted 1 line · Alexander Viro

And what kind of meaning would you assign to truncate on floppy?

On a block or char device, truncate == lseek seems reasonable.

My guess is that dd uses ftruncate because that's correct for regular files and has happened to also work (as an alias for lseek) for devices.

Quoted 1 line

Use conv=notrunc.

I didn't know about notrunc. Yet another GNU invention?

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 5 lines · Mikael Pettersson
Quoted 1 line · Alexander Viro

And what kind of meaning would you assign to truncate on floppy?

On a block or char device, truncate == lseek seems reasonable.

Huh? On regular files ftruncate() doesn't modify the current position at all. Try and you'll see. Besides, WTF _is_ lseek() for a character device?

Quoted 7 lines

My guess is that dd uses ftruncate because that's correct for regular files and has happened to also work (as an alias for lseek) for devices.

Quoted 1 line

Use conv=notrunc.

I didn't know about notrunc. Yet another GNU invention?

Maybe, but I doubt it. Anyway, it made its way into 4.4BSD, it's present in Solaris, it's in SuS and AFAIK in POSIX. GNU might be the origin, but it might equally well be a BSDism.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Mikael Pettersson
Quoted 4 lines · Alexander Viro
Quoted 1 line

I didn't know about notrunc. Yet another GNU invention?

Maybe, but I doubt it. Anyway, it made its way into 4.4BSD, it's present in Solaris, it's in SuS and AFAIK in POSIX.

Yes (for 1003.2-1992).
It is not in 4.3BSD.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/