Hi Roland,

Sorry for the very late response.

On 2018-01-19, you wrote:

> i tried to compare performance of shred and dd, because a colleague
> told, shred -n0 -z would be faster.
> 
> the shred manpage tells:
> If FILE is -, shred standard output 
> 
> But:
> # shred - | pv >/dev/null
> shred: - invalid file type
> 0 B 0:00:00 [   0 B/s]  [<=>
> 
> i found https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=155175 
> 
> as "-" works when redirecting to a file, i assume it doesn't work with
> a pipe because shred needs to seek within the file, which is not
> possible with a pipe.
> 
> i think shred -n0 -z  could be handled as a special case but it would
> not be worth the effort.

Maybe, but you can always read and discard the data if the input isn't
seekable.

I assume the primary reason that it doesn't work on pipes is because
that data has not been written to disk. The same is true for FIFOs and
sockets, which 'shred' will skip.

> could you perhaps enhance the manpage apropriately, as already
> suggested in the debian bugreport?

I think that is a good idea. The limitation applies to any files though,
not just standard output, so I placed it away from that sentence.

I haven't pushed it yet in case anyone has ideas to improve the
wording. The texinfo manual should probably have a similar sentence,
too. I can add that later.

Thanks,
Collin

>From 6d6f1f36904ed0ac648664f111a40faa095469b3 Mon Sep 17 00:00:00 2001
Message-ID: <6d6f1f36904ed0ac648664f111a40faa095469b3.1778637055.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Tue, 12 May 2026 18:35:28 -0700
Subject: [PATCH] doc: shred: mention unsupported file types in --help

* src/shred.c (usage): Mention the behavior of 'shred' on FIFOs,
sockets, and terminals.
---
 src/shred.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/shred.c b/src/shred.c
index 316268691..a0b7089f5 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -220,6 +220,11 @@ If FILE is -, shred standard output.\n\
       oputs (VERSION_OPTION_DESCRIPTION);
       fputs (_("\
 \n\
+FILE will be skipped with a diagnostic message if it is a FIFO, socket, or\n\
+terminal, since its data does not reside on disk.\n\
+"), stdout);
+      fputs (_("\
+\n\
 Delete FILE(s) if --remove (-u) is specified.  The default is not to remove\n\
 the files because it is common to operate on device files like /dev/hda,\n\
 and those files usually should not be removed.\n\
-- 
2.54.0

Reply via email to