Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #267123 > unrolled thread

Unidentified subject!

Started bygene heskett <gheskett@shentel.net>
First post2024-02-07 21:40 +0100
Last post2024-02-09 14:20 +0100
Articles 20 on this page of 98 — 20 participants

Back to article view | Back to linux.debian.user


Contents

  Unidentified subject! gene heskett <gheskett@shentel.net> - 2024-02-07 21:40 +0100
    Re: Unidentified subject! Stefan Monnier <monnier@iro.umontreal.ca> - 2024-02-08 05:30 +0100
      Re: Unidentified subject! gene heskett <gheskett@shentel.net> - 2024-02-10 11:00 +0100
        Re: Unidentified subject! "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-10 11:40 +0100
          shred bug? [was: Unidentified subject!] <tomas@tuxteam.de> - 2024-02-10 13:50 +0100
            Re: shred bug? [was: Unidentified subject!] tomas@tuxteam.de - 2024-02-10 14:00 +0100
              Re: shred bug? "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-10 15:00 +0100
                Re: shred bug? <tomas@tuxteam.de> - 2024-02-10 15:40 +0100
            Re: shred bug? Gremlin <scott-andrews@columbus.rr.com> - 2024-02-10 14:40 +0100
            Re: shred bug? "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-10 14:40 +0100
            Re: shred bug? [was: Unidentified subject!] David Christensen <dpchrist@holgerdanske.com> - 2024-02-11 01:10 +0100
              Re: shred bug? [was: Unidentified subject!] Greg Wooledge <greg@wooledge.org> - 2024-02-11 01:20 +0100
                Re: shred bug? [was: Unidentified subject!] David Christensen <dpchrist@holgerdanske.com> - 2024-02-11 01:30 +0100
                  Re: shred bug? [was: Unidentified subject!] debian-user@howorth.org.uk - 2024-02-11 14:00 +0100
                    Re: shred bug? "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-11 14:30 +0100
                Re: shred bug? [was: Unidentified subject!] <tomas@tuxteam.de> - 2024-02-11 08:10 +0100
                  Re: shred bug? [was: Unidentified subject!] Greg Wooledge <greg@wooledge.org> - 2024-02-11 15:40 +0100
                    Re: shred bug? [was: Unidentified subject!] <tomas@tuxteam.de> - 2024-02-11 15:50 +0100
                      Re: shred bug? [was: Unidentified subject!] Greg Wooledge <greg@wooledge.org> - 2024-02-11 16:00 +0100
                        Re: shred bug? [was: Unidentified subject!] <tomas@tuxteam.de> - 2024-02-11 16:00 +0100
                          Re: shred bug? [was: Unidentified subject!] Greg Wooledge <greg@wooledge.org> - 2024-02-12 18:00 +0100
                          Re: shred bug? [was: Unidentified subject!] Curt <curty@free.fr> - 2024-02-12 18:00 +0100
                            Re: shred bug? [was: Unidentified subject!] David Christensen <dpchrist@holgerdanske.com> - 2024-02-12 22:00 +0100
                              Re: shred bug? [was: Unidentified subject!] "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-12 22:10 +0100
                                Re: shred bug? [was: Unidentified subject!] <tomas@tuxteam.de> - 2024-02-13 06:50 +0100
                        Re: shred bug? [was: Unidentified subject!] David Wright <deblis@lionunicorn.co.uk> - 2024-02-11 16:30 +0100
                          Re: shred bug? [was: Unidentified subject!] Greg Wooledge <greg@wooledge.org> - 2024-02-13 13:20 +0100
                            Re: shred bug? [was: Unidentified subject!] Greg Wooledge <greg@wooledge.org> - 2024-02-13 13:40 +0100
                              Re: shred bug? [was: Unidentified subject!] <tomas@tuxteam.de> - 2024-02-13 13:50 +0100
                            Re: shred bug? [was: Unidentified subject!] "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-13 14:00 +0100
                            Re: shred bug? [was: Unidentified subject!] David Wright <deblis@lionunicorn.co.uk> - 2024-02-13 16:40 +0100
                              Re: shred bug? [was: Unidentified subject!] Greg Wooledge <greg@wooledge.org> - 2024-02-13 17:30 +0100
                                Re: shred bug? [was: Unidentified subject!] debian-user@howorth.org.uk - 2024-02-13 18:50 +0100
                                  Re: shred bug? [was: Unidentified subject!] David Christensen <dpchrist@holgerdanske.com> - 2024-02-13 22:10 +0100
                                    Re: shred bug? [was: Unidentified subject!] <tomas@tuxteam.de> - 2024-02-14 06:50 +0100
                                Re: shred bug? [was: Unidentified subject!] "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-13 19:00 +0100
                                  Re: shred bug? [was: Unidentified subject!] Greg Wooledge <greg@wooledge.org> - 2024-02-13 20:00 +0100
                                    Re: shred bug? [was: Unidentified subject!] "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-13 20:40 +0100
                                  Re: shred bug? [was: Unidentified subject!] gene heskett <gheskett@shentel.net> - 2024-02-13 20:40 +0100
                                    Re: shred bug? [was: Unidentified subject!] "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-13 20:50 +0100
                                      Re: shred bug? [was: Unidentified subject!] gene heskett <gheskett@shentel.net> - 2024-02-13 21:30 +0100
                                    Re: shred bug? [was: Unidentified subject!] David Christensen <dpchrist@holgerdanske.com> - 2024-02-13 22:10 +0100
                                      Re: shred bug? [was: Unidentified subject!] gene heskett <gheskett@shentel.net> - 2024-02-13 22:50 +0100
                                Re: shred bug? [was: Unidentified subject!] David Wright <deblis@lionunicorn.co.uk> - 2024-02-15 06:40 +0100
                        Re: shred bug? [was: Unidentified subject!] David Christensen <dpchrist@holgerdanske.com> - 2024-02-11 23:50 +0100
                          Re: shred bug? [was: Unidentified subject!] Max Nikulin <manikulin@gmail.com> - 2024-02-13 03:40 +0100
                      Re: shred bug? [was: Unidentified subject!] "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-11 16:30 +0100
                  Re: shred bug? [was: Unidentified subject!] Michael Stone <mstone@debian.org> - 2024-02-16 16:00 +0100
          Re: Unidentified subject! gene heskett <gheskett@shentel.net> - 2024-02-10 18:50 +0100
            Re: Unidentified subject! "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-10 19:40 +0100
              Re: Unidentified subject! gene heskett <gheskett@shentel.net> - 2024-02-10 20:30 +0100
              Re: Unidentified subject! David Christensen <dpchrist@holgerdanske.com> - 2024-02-11 00:50 +0100
                Re: Unidentified subject! "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-11 09:10 +0100
                  Re: Unidentified subject! David Christensen <dpchrist@holgerdanske.com> - 2024-02-11 21:50 +0100
          Re: Unidentified subject! David Christensen <dpchrist@holgerdanske.com> - 2024-02-11 00:40 +0100
            Re: Unidentified subject! "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-11 09:20 +0100
              Re: Unidentified subject! David Christensen <dpchrist@holgerdanske.com> - 2024-02-11 11:10 +0100
                Fast Random Data Generation (Was: Re: Unidentified subject!) Linux-Fan <Ma_Sys.ma@web.de> - 2024-02-11 11:30 +0100
                  Re: Fast Random Data Generation "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-11 12:30 +0100
                  Re: Fast Random Data Generation (Was: Re: Unidentified subject!) Gremlin <scott-andrews@columbus.rr.com> - 2024-02-11 13:20 +0100
                  Re: Fast Random Data Generation (Was: Re: Unidentified subject!) David Christensen <dpchrist@holgerdanske.com> - 2024-02-12 07:20 +0100
                    Re: Fast Random Data Generation (Was: Re: Unidentified subject!) Linux-Fan <Ma_Sys.ma@web.de> - 2024-02-12 17:40 +0100
                      Re: Fast Random Data Generation (Was: Re: Unidentified subject!) David Christensen <dpchrist@holgerdanske.com> - 2024-02-12 22:30 +0100
                        Re: Fast Random Data Generation (Was: Re: Unidentified subject!) Linux-Fan <Ma_Sys.ma@web.de> - 2024-02-13 18:40 +0100
                      Re: Fast Random Data Generation (Was: Re: Unidentified subject!) Jeffrey Walton <noloader@gmail.com> - 2024-02-12 22:30 +0100
                Re: Unidentified subject! "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-11 12:20 +0100
                  Re: Unidentified subject! Jeffrey Walton <noloader@gmail.com> - 2024-02-11 16:20 +0100
                  Re: Unidentified subject! David Christensen <dpchrist@holgerdanske.com> - 2024-02-11 23:00 +0100
        Re: Unidentified subject! Stefan Monnier <monnier@iro.umontreal.ca> - 2024-02-10 15:40 +0100
    Things I don't touch with a 3.048m barge pole: USB storage (Was Re:  Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 16:40 +0100
      Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Gremlin <scott-andrews@columbus.rr.com> - 2024-02-08 17:20 +0100
        Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 17:30 +0100
        Re: Things I don't touch with a 3.048m barge pole: USB storage  (WasRe: Unidentified subject!) gene heskett <gheskett@shentel.net> - 2024-02-09 09:50 +0100
      Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Ralph Aichinger <ra@h5.or.at> - 2024-02-08 18:00 +0100
        Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Jeffrey Walton <noloader@gmail.com> - 2024-02-08 20:30 +0100
          Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 21:50 +0100
          Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 21:50 +0100
            Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Gremlin <scott-andrews@columbus.rr.com> - 2024-02-08 22:00 +0100
              Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 22:20 +0100
                Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 22:30 +0100
                  Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Gremlin <scott-andrews@columbus.rr.com> - 2024-02-08 23:10 +0100
                Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Gremlin <scott-andrews@columbus.rr.com> - 2024-02-08 22:30 +0100
            Re: Things I don't touch with a 3.048m barge pole: USB storage  (WasRe: Unidentified subject!) gene heskett <gheskett@shentel.net> - 2024-02-09 14:00 +0100
              Re: Things I don't touch with a 3.048m barge pole "Thomas Schmitt" <scdbackup@gmx.net> - 2024-02-09 14:50 +0100
              Re: Things I don't touch with a 3.048m barge pole: USB storage  (WasRe: Unidentified subject!) David Christensen <dpchrist@holgerdanske.com> - 2024-02-10 07:00 +0100
                Re: Things I don't touch with a 3.048m barge pole: USB storage(WasRe:  Unidentified subject!) gene heskett <gheskett@shentel.net> - 2024-02-10 18:40 +0100
        Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 21:40 +0100
          Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Arno Lehmann <al@its-lehmann.de> - 2024-02-09 09:50 +0100
      Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Max Nikulin <manikulin@gmail.com> - 2024-02-08 18:30 +0100
        Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 21:40 +0100
          Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Gremlin <scott-andrews@columbus.rr.com> - 2024-02-08 22:10 +0100
            Re: Things I don't touch with a 3.048m barge pole: USB storage (Was  Re: Unidentified subject!) Andy Smith <andy@strugglers.net> - 2024-02-08 22:20 +0100
    Re: Unidentified subject! Richmond <dnomhcir@gmx.com> - 2024-02-08 23:50 +0100
      Re: Unidentified subject! Stefan Monnier <monnier@iro.umontreal.ca> - 2024-02-09 00:10 +0100
        Re: Unidentified subject! Charles Curley <charlescurley@charlescurley.com> - 2024-02-09 00:50 +0100
          Re: Unidentified subject! Richmond <dnomhcir@gmx.com> - 2024-02-09 05:50 +0100
            Re: Unidentified flying subject! Charles Curley <charlescurley@charlescurley.com> - 2024-02-09 07:50 +0100
              Re: Unidentified flying subject! Richmond <dnomhcir@gmx.com> - 2024-02-09 14:20 +0100

Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →


#267328 — Re: shred bug? [was: Unidentified subject!]

FromGreg Wooledge <greg@wooledge.org>
Date2024-02-12 18:00 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I6HOV-9GLs-13@gated-at.bofh.it>
In reply to#267295
On Mon, Feb 12, 2024 at 04:50:50PM -0000, Curt wrote:
> On 2024-02-11, <tomas@tuxteam.de> <tomas@tuxteam.de> wrote:
> >
> >
> > On Sun, Feb 11, 2024 at 09:54:24AM -0500, Greg Wooledge wrote:
> >
> > [...]
> >
> >>        If FILE is -, shred standard output.
> >>=20
> >> In every sentence, the word FILE appears.  There's nothing in there
> >> which says "you can operate on a non-file".
> >
> > Point taken, yes.
> 
> I thought everything was a file.

An anonymous pipe(2) in memory between two processes isn't even close to
a file.  Also, you're confusing Linux and Plan 9.  Linux has a bunch of
things that aren't files, such as network interfaces.

[toc] | [prev] | [next] | [standalone]


#267329 — Re: shred bug? [was: Unidentified subject!]

FromCurt <curty@free.fr>
Date2024-02-12 18:00 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I6HOV-9GLs-11@gated-at.bofh.it>
In reply to#267295
On 2024-02-11, <tomas@tuxteam.de> <tomas@tuxteam.de> wrote:
>
>
> On Sun, Feb 11, 2024 at 09:54:24AM -0500, Greg Wooledge wrote:
>
> [...]
>
>>        If FILE is -, shred standard output.
>>=20
>> In every sentence, the word FILE appears.  There's nothing in there
>> which says "you can operate on a non-file".
>
> Point taken, yes.

I thought everything was a file.

[toc] | [prev] | [next] | [standalone]


#267337 — Re: shred bug? [was: Unidentified subject!]

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2024-02-12 22:00 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I6Lzc-9J0V-9@gated-at.bofh.it>
In reply to#267329
On 2/12/24 08:50, Curt wrote:
> On 2024-02-11, <tomas@tuxteam.de> <tomas@tuxteam.de> wrote:
>>
>>
>> On Sun, Feb 11, 2024 at 09:54:24AM -0500, Greg Wooledge wrote:
>>
>> [...]
>>
>>>         If FILE is -, shred standard output.
>>> =20
>>> In every sentence, the word FILE appears.  There's nothing in there
>>> which says "you can operate on a non-file".
>>
>> Point taken, yes.
> 
> I thought everything was a file.


"Everything is a file" is a design feature of the Unix operating system:

https://en.wikipedia.org/wiki/Everything_is_a_file


But, there is more than one kind of file.


And, not every program supports every kind of file.


The manual page for find(1) provides a shopping list of file types it 
supports:

2024-02-12 12:32:13 dpchrist@laalaa ~
$ man find | egrep -A 20 '^       .type c'
        -type c
               File is of type c:

               b      block (buffered) special

               c      character (unbuffered) special

               d      directory

               p      named pipe (FIFO)

               f      regular file

               l      symbolic link; this is never true if  the
                      -L option or the -follow option is in ef-
                      fect, unless the symbolic link is broken.
                      If  you want to search for symbolic links
                      when -L is in effect, use -xtype.

               s      socket


As for shred(1), the argument FILE is conventionally a regular file.  We 
are discussing the special case described in the manual page:

        If FILE is -, shred standard output.


David

[toc] | [prev] | [next] | [standalone]


#267338 — Re: shred bug? [was: Unidentified subject!]

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2024-02-12 22:10 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I6LIR-9Jjv-9@gated-at.bofh.it>
In reply to#267337
Hi,

> https://en.wikipedia.org/wiki/Everything_is_a_file
> But, there is more than one kind of file.

"All files are equal.
 But some files are more equal than others."

(George Orwell in his dystopic novel "Server Farm".)


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#267345 — Re: shred bug? [was: Unidentified subject!]

From<tomas@tuxteam.de>
Date2024-02-13 06:50 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I6TQ5-9OnG-1@gated-at.bofh.it>
In reply to#267338

[Multipart message — attachments visible in raw view] — view raw

On Mon, Feb 12, 2024 at 10:07:45PM +0100, Thomas Schmitt wrote:
> Hi,
> 
> > https://en.wikipedia.org/wiki/Everything_is_a_file
> > But, there is more than one kind of file.
> 
> "All files are equal.
>  But some files are more equal than others."
> 
> (George Orwell in his dystopic novel "Server Farm".)

:-D

Yesterday I was on the brink of quoting that. Great minds and
all of that...

Reality though is, that if you don't design your file with
magical properties from the get-go, you will keep stumbling
on stuff you want to model and which don't fit the real
life file design you chose.

And yes, Plan 9, as someone else noted in this thread, takes
that to a bigger extreme: in their windowing system, windows
are files, too -- you can remove a window by deleting the
corresponding file.

Cheers
-- 
t

[toc] | [prev] | [next] | [standalone]


#267299 — Re: shred bug? [was: Unidentified subject!]

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2024-02-11 16:30 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I6jWi-9shk-5@gated-at.bofh.it>
In reply to#267294
On Sun 11 Feb 2024 at 09:54:24 (-0500), Greg Wooledge wrote:
> On Sun, Feb 11, 2024 at 03:45:21PM +0100, tomas@tuxteam.de wrote:
> > On Sun, Feb 11, 2024 at 09:37:31AM -0500, Greg Wooledge wrote:
> > > On Sun, Feb 11, 2024 at 08:02:12AM +0100, tomas@tuxteam.de wrote:
> > 
> > [...]
> > 
> > > > What Thomas was trying to do is to get a cheap, fast random number
> > > > generator. Shred seems to have such.
> > > 
> > > Well... I certainly wouldn't call it a bug.  Maybe a feature request.
> > 
> > Still there's the discrepancy between doc and behaviour.
> 
> There isn't.  The documentation says:
> 
> SYNOPSIS
>        shred [OPTION]... FILE...
> 
> DESCRIPTION
>        Overwrite  the specified FILE(s) repeatedly, in order to make it harder
>        for even very expensive hardware probing to recover the data.
> 
>        If FILE is -, shred standard output.
> 
> In every sentence, the word FILE appears.  There's nothing in there
> which says "you can operate on a non-file".
> 
> Once you grasp what the command is *intended* to do (rewind and overwrite
> a file repeatedly), it makes absolutely perfect sense that it should
> only operate on rewindable file system objects.
> 
> If you want it to write a stream of data instead of performing its normal
> operation (rewinding and rewriting), that's a new feature.
> 
> If you'd prefer the documentation to say explicitly "only regular files
> and block devices are allowed", that would be an upstream documentation
> *clarification* request.

Perhaps info puts it better?

   A FILE of ‘-’ denotes standard output.  The intended use of this is
   to shred a removed temporary file.  For example:

      i=$(mktemp)
      exec 3<>"$i"
      rm -- "$i"
      echo "Hello, world" >&3
      shred - >&3
      exec 3>-

   However, the command ‘shred - >file’ does not shred the contents of
   FILE, since the shell truncates FILE before invoking ‘shred’.  Use
   the command ‘shred file’ or (if using a Bourne-compatible shell) the
   command ‘shred - 1<>file’ instead.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#267351 — Re: shred bug? [was: Unidentified subject!]

FromGreg Wooledge <greg@wooledge.org>
Date2024-02-13 13:20 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I6ZVv-9SfF-1@gated-at.bofh.it>
In reply to#267299
On Mon, Feb 12, 2024 at 11:01:47PM -0600, David Wright wrote:
> … but not much. For me, "standard output" is /dev/fd/1, yet it seems
> unlikely that anyone is going to use >&1 in the manner of the example.

Standard output means "whatever file descriptor 1 points to".  That
could be a file, a pipe, a terminal (character device), etc.

> I might write something like: "The option ‘-’ shreds the file specified
> by the redirection ‘>&N’", though there could be a better name for ‘>&N’.

You're assuming the program will be used from a shell.  This is *usually*
going to be true, but nothing prevents you from writing a C program
which closes stdout, opens a file, ensures that it's using FD 1,
and then calls "shred -".  The documentation has to support this use
case as well.

> >    A FILE of ‘-’ denotes standard output.  The intended use of this is
> >    to shred a removed temporary file.  For example:
> > 
> >       i=$(mktemp)
> >       exec 3<>"$i"
> >       rm -- "$i"
> >       echo "Hello, world" >&3
> >       shred - >&3
> >       exec 3>-
> 
> I can see that the last line truncates the "anonymous" file,

No, that's not what it does at all.  In fact, that last line is
written incorrectly.  It should say "exec 3>&-" and what that does
is close file descriptor 3, which was previously opened on line 2.

What it actually does *as written* is create/truncate a file whose
name is "-", close the previously opened FD 3, and make FD 3 point
to the file named "-".

unicorn:~$ exec 3>-
unicorn:~$ ls -ld -- -
-rw-r--r-- 1 greg greg 0 Feb 13 07:12 -
unicorn:~$ ls -l /dev/fd/3
l-wx------ 1 greg greg 64 Feb 13 07:12 /dev/fd/3 -> /home/greg/-

This is an obvious bug in the info page.  I wonder how many years
this has gone unnoticed.

[toc] | [prev] | [next] | [standalone]


#267352 — Re: shred bug? [was: Unidentified subject!]

FromGreg Wooledge <greg@wooledge.org>
Date2024-02-13 13:40 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I70eR-9SlE-5@gated-at.bofh.it>
In reply to#267351
On Tue, Feb 13, 2024 at 07:15:48AM -0500, Greg Wooledge wrote:
> This is an obvious bug in the info page.  I wonder how many years
> this has gone unnoticed.

I've filed Bug#1063837 for it.  <https://bugs.debian.org/1063837>

[toc] | [prev] | [next] | [standalone]


#267353 — Re: shred bug? [was: Unidentified subject!]

From<tomas@tuxteam.de>
Date2024-02-13 13:50 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I70ox-9Spa-1@gated-at.bofh.it>
In reply to#267352

[Multipart message — attachments visible in raw view] — view raw

On Tue, Feb 13, 2024 at 07:36:14AM -0500, Greg Wooledge wrote:
> On Tue, Feb 13, 2024 at 07:15:48AM -0500, Greg Wooledge wrote:
> > This is an obvious bug in the info page.  I wonder how many years
> > this has gone unnoticed.
> 
> I've filed Bug#1063837 for it.  <https://bugs.debian.org/1063837>

Well, thanks for doing TRT :-)

Cheers
-- 
t

[toc] | [prev] | [next] | [standalone]


#267354 — Re: shred bug? [was: Unidentified subject!]

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2024-02-13 14:00 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I70yd-9Ssm-1@gated-at.bofh.it>
In reply to#267351
Hi,

"info shred" says:
> > >       i=$(mktemp)
> > >       exec 3<>"$i"
> > >       rm -- "$i"
> > >       echo "Hello, world" >&3
> > >       shred - >&3
> > >       exec 3>-

Greg Wooledge wrote:
> In fact, that last line is
> written incorrectly.  It should say "exec 3>&-" and what that does
> is close file descriptor 3, which was previously opened on line 2.
> [...]
> This is an obvious bug in the info page.  I wonder how many years
> this has gone unnoticed.

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=155175#36
of 22 Dec 2005 states:

  "I'll assume that this is now adequately explained in the info page
   (below).  If not then please reopen.          // Thomas Hood
   [...]
   exec 3>-"

The bug report is from 02 Aug 2002 and states that the info page contains
the short and broad promise which we can still see in "man shred".

So we can assume a bug age of 18 to 22 years.


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#267355 — Re: shred bug? [was: Unidentified subject!]

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2024-02-13 16:40 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I7334-9U23-7@gated-at.bofh.it>
In reply to#267351
On Tue 13 Feb 2024 at 07:15:48 (-0500), Greg Wooledge wrote:
> On Mon, Feb 12, 2024 at 11:01:47PM -0600, David Wright wrote:
> > … but not much. For me, "standard output" is /dev/fd/1, yet it seems
> > unlikely that anyone is going to use >&1 in the manner of the example.
> 
> Standard output means "whatever file descriptor 1 points to".  That
> could be a file, a pipe, a terminal (character device), etc.

Why pick on 1?

> > I might write something like: "The option ‘-’ shreds the file specified
> > by the redirection ‘>&N’", though there could be a better name for ‘>&N’.
> 
> You're assuming the program will be used from a shell.  This is *usually*
> going to be true, but nothing prevents you from writing a C program
> which closes stdout, opens a file, ensures that it's using FD 1,
> and then calls "shred -".  The documentation has to support this use
> case as well.

/As well/ — which is why I wrote N in place of 1. The original bug
report (which I hadn't seen until Thomas' post) says:
 "If you redirect output to a file it will work. Shredding a tty doesn't
  make much sense, after all."
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=155175#10

Now, you can't write "If you redirect output to a file it will work"
in a man page—it needs recasting into something more like what
I wrote above, which contains two key points:

. It points out that '-' is an option, not a filename or a stand-in
  for one, and it doesn't use the word standard, which is totally
  irrelevant in the circumstances.

. It demonstrates the shell syntax element required (&) in order to
  avoid truncating the file, rather than shred overwriting it.

I think that getting the "&" into the man page would be helpful
to anybody who doesn't look at the info page for the example.
It might have shortened the early part of this thread as well.

As for C programmers, neither FD number nor truncation is relevant.
Sure, you can pick 1. But you don't have to document that for shred.
And truncation is an accident that can occur because of shell's
redirect syntax: there's no equivalent in programs.

> > >    A FILE of ‘-’ denotes standard output.  The intended use of this is
> > >    to shred a removed temporary file.  For example:
> > > 
> > >       i=$(mktemp)
> > >       exec 3<>"$i"
> > >       rm -- "$i"
> > >       echo "Hello, world" >&3
> > >       shred - >&3
> > >       exec 3>-
> > 
> > I can see that the last line truncates the "anonymous" file,
> 
> No, that's not what it does at all.  In fact, that last line is
> written incorrectly.  It should say "exec 3>&-" and what that does
> is close file descriptor 3, which was previously opened on line 2.
> 
> What it actually does *as written* is create/truncate a file whose
> name is "-", close the previously opened FD 3, and make FD 3 point
> to the file named "-".
> 
> unicorn:~$ exec 3>-
> unicorn:~$ ls -ld -- -
> -rw-r--r-- 1 greg greg 0 Feb 13 07:12 -
> unicorn:~$ ls -l /dev/fd/3
> l-wx------ 1 greg greg 64 Feb 13 07:12 /dev/fd/3 -> /home/greg/-
> 
> This is an obvious bug in the info page.  I wonder how many years
> this has gone unnoticed.

Well spotted. That's what an experienced eye brings to a line like
that, whereas I assumed it meant something beyond my experience,
and searched for it.

Ironic that it truncates a file, and then immediately warns against
truncating a file instead of shredding it.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#267356 — Re: shred bug? [was: Unidentified subject!]

FromGreg Wooledge <greg@wooledge.org>
Date2024-02-13 17:30 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I73Pr-9Uy1-5@gated-at.bofh.it>
In reply to#267355
On Tue, Feb 13, 2024 at 09:35:11AM -0600, David Wright wrote:
> On Tue 13 Feb 2024 at 07:15:48 (-0500), Greg Wooledge wrote:
> > On Mon, Feb 12, 2024 at 11:01:47PM -0600, David Wright wrote:
> > > … but not much. For me, "standard output" is /dev/fd/1, yet it seems
> > > unlikely that anyone is going to use >&1 in the manner of the example.
> > 
> > Standard output means "whatever file descriptor 1 points to".  That
> > could be a file, a pipe, a terminal (character device), etc.
> 
> Why pick on 1?

It's the definition.  Standard input is FD 0, standard output is FD 1,
and standard error is FD 2.

> . It demonstrates the shell syntax element required (&) in order to
>   avoid truncating the file, rather than shred overwriting it.

You are confused.  You're making assumptions about shell syntax that
are simply not true.

> > > >    A FILE of ‘-’ denotes standard output.  The intended use of this is
> > > >    to shred a removed temporary file.  For example:
> > > > 
> > > >       i=$(mktemp)
> > > >       exec 3<>"$i"
> > > >       rm -- "$i"
> > > >       echo "Hello, world" >&3
> > > >       shred - >&3
> > > >       exec 3>-

> Ironic that it truncates a file, and then immediately warns against
> truncating a file instead of shredding it.

No.  This is not what it does (if we fix the bug).

Let me write out the example again, but with the bug fixed, and then
explain what each line does, because apparently there is a LOT of
misunderstanding here.

  i=$(mktemp)
  exec 3<>"$i"
  rm -- "$i"
  echo "Hello, world" >&3
  shred - >&3
  exec 3>&-

The first line runs mktemp(1), which is a GNU coreutils program that
creates a temporary file, and then writes its name to standard output.
The shell syntax grabs that name and stores it in the variable "i".

So, after line 1, we have an (empty) temporary file, which was created
by a child process that has terminated.  We have its name in a variable.

Creation of temporary files works a little bit differently in shell
scripts than it does in regular programs.  In most other languages,
you would call a library function that creates the temporary file
(keeping it open), optionally unlinks it, and returns the open file
descriptor to you for use.  But you can't do that in a shell script
that needs an external program to do the file creation.  So we have this
slightly clumsy approach.

The second line opens this file for reading and writing, and ensures
that file descriptor 3 points to it.  It's important to understand that
while "exec 3>$i" would have truncated the file's contents, "exec 3<>$i"
does not.  Of course, there wasn't any content to truncate, since it was
created empty, but that's not the important part.  The important part
is that this FD is opened for read+write, allowing the temporary file
to be used for storage *and* retrieval.  We aren't doing any retrieval
in this example, but it could be done, with specialized tools.

The third line unlinks the file from the file system.  However, the shell
still has an open file descriptor which points to the file.  Therefore,
the file is still accessible through this FD.  Its inode is not recycled,
and any blocks containing file content are not marked for reuse.

This "unlink before using" technique is traditional on Unix systems.
It allows you to bypass setting up an exit handler to clean up the
temporary file.  Once the open file descriptor is closed, the file
system will mark the inode and any blocks as ready for reuse.  Even if
the script is killed by SIGKILL, that cleanup will still happen.

The fourth line writes some content via the open file descriptor 3.  At
this point, our unlinked file now has data in it.  Presumably this data
is super private, and we don't want anyone to be able to recover it.
When the script exits, the open file descriptor will close, and the file
system will mark the file's blocks as reusable, but it won't *actually*
reuse them until something else comes along and claims them.  But that's
what shred is designed for.

The fifth line calls shred(1), instructing it to destroy the content
that's in the unlinked file.  Since the file is unlinked, it has no name,
and therefore shred can't be *given* a name.  However, we have a file
descriptor that points to it.  So, what we *can* do is point standard
output to the file (that's what >&3 does), and then tell shred to destroy
the file that's pointed to by stdout.

Shred will determine the size of the file, then write data to the file,
rewind, write data again, etc.  On a traditional hard drive, that will
overwrite the original private information.  On modern devices, it may
not.

Finally, the sixth line closes file descriptor 3.  Doing this frees the
file's inode and blocks, allowing them to be reused by a future program.

The key to understanding this example is a firm grasp of the shell's
redirection syntax and semantics.

Let's start with what people normally see:  3>filename

That opens "filename" for writing with truncation, and ensures that FD 3
points to it, so the script can do things to it by referencing FD 3.
If the file doesn't exist, it'll be created.  If it does exist, it'll be
truncated.

Next, we have this guy:   3<>filename

This opens "filename" for reading and writing, without truncation.  If
the file exists, it'll be opened, but not truncated.  If the file doesn't
exist, it'll be created.

Third, we've got this one:   >&3

This is a shorthand for 1>&3 (the 1 is implied if missing), which is a
file descriptor duplication.  What this does is find where FD 3 is
currently pointing, and make FD 1 *also* point there.

So when we run a command like:    echo "Hello, world" >&3

What that does is find where FD 3 is pointing, make FD 1 (stdout) also
point there, and then run an echo command, which writes to stdout.
The end result is that echo puts some content into wherever FD 3 is
pointing.

This duplication is also used in the shred command:   shred - >&3

Again, this command finds out where FD 3 is pointing, makes FD 1 (stdout)
point to the same place, and then runs "shred -" which asks shred
to overwrite the file that's pointed to by stdout.

Finally, we have this guy:   3>&-

This closes file descriptor 3.  It doesn't have to be 3<>&- even though
FD 3 was originally opened for bidirectional access.  3>&- is sufficient
no matter how the FD was opened.

[toc] | [prev] | [next] | [standalone]


#267361 — Re: shred bug? [was: Unidentified subject!]

Fromdebian-user@howorth.org.uk
Date2024-02-13 18:50 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I754R-9Vdq-1@gated-at.bofh.it>
In reply to#267356
Greg Wooledge <greg@wooledge.org> wrote:

> Shred will determine the size of the file, then write data to the
> file, rewind, write data again, etc.  On a traditional hard drive,
> that will overwrite the original private information.  On modern
> devices, it may not.

Thanks for the excellent explanation :)

One nitpick. You say "On a traditional hard drive, that will overwrite
the original private information" but that's not quite true. It also
needs to be a "traditional" file system! That is, not journalled or COW.

So nowadays I would expect shred not to work unless you got very
lucky, or planned carefully.

[toc] | [prev] | [next] | [standalone]


#267375 — Re: shred bug? [was: Unidentified subject!]

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2024-02-13 22:10 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I78cq-9Xkc-9@gated-at.bofh.it>
In reply to#267361
On 2/13/24 09:40, debian-user@howorth.org.uk wrote:
> Greg Wooledge <greg@wooledge.org> wrote:
> 
>> Shred will determine the size of the file, then write data to the
>> file, rewind, write data again, etc.  On a traditional hard drive,
>> that will overwrite the original private information.  On modern
>> devices, it may not.
> 
> Thanks for the excellent explanation :)
> 
> One nitpick. You say "On a traditional hard drive, that will overwrite
> the original private information" but that's not quite true. It also
> needs to be a "traditional" file system! That is, not journalled or COW.
> 
> So nowadays I would expect shred not to work unless you got very
> lucky, or planned carefully.


Perhaps zerofree(8)?


David

[toc] | [prev] | [next] | [standalone]


#267395 — Re: shred bug? [was: Unidentified subject!]

From<tomas@tuxteam.de>
Date2024-02-14 06:50 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I7gjD-a28X-1@gated-at.bofh.it>
In reply to#267375

[Multipart message — attachments visible in raw view] — view raw

On Tue, Feb 13, 2024 at 01:03:44PM -0800, David Christensen wrote:
> On 2/13/24 09:40, debian-user@howorth.org.uk wrote:
> > Greg Wooledge <greg@wooledge.org> wrote:
> > 
> > > Shred will determine the size of the file, then write data to the
> > > file, rewind, write data again, etc.  On a traditional hard drive,
> > > that will overwrite the original private information.  On modern
> > > devices, it may not.
> > 
> > Thanks for the excellent explanation :)
> > 
> > One nitpick. You say "On a traditional hard drive, that will overwrite
> > the original private information" but that's not quite true. It also
> > needs to be a "traditional" file system! That is, not journalled or COW.
> > 
> > So nowadays I would expect shred not to work unless you got very
> > lucky, or planned carefully.
> 
> 
> Perhaps zerofree(8)?

On a SATA, it won't get at (some) of the spare blocks, since it
doesn't know that they are there.

If your data is so sensitive that you don't want it to escape,
your best bet seems to plan ahead and not let it hit your media
unencrypted.

Use LUKS. And oh, use argon2id as key derivation function [1]
these days.

Cheers
[1] https://mjg59.dreamwidth.org/66429.html
-- 
t

[toc] | [prev] | [next] | [standalone]


#267363 — Re: shred bug? [was: Unidentified subject!]

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2024-02-13 19:00 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I75ex-9VgV-7@gated-at.bofh.it>
In reply to#267356
Hi,

Greg Wooledge wrote:
> Let me write out the example again, but with the bug fixed, and then
> explain what each line does, [... lecture about advanced shell
> programming ...]

And this all because Gene Heskett was adventurous enough to buy a cheap
fake USB disk. :))


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#267365 — Re: shred bug? [was: Unidentified subject!]

FromGreg Wooledge <greg@wooledge.org>
Date2024-02-13 20:00 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I76aB-9VPp-9@gated-at.bofh.it>
In reply to#267363
On Tue, Feb 13, 2024 at 06:54:58PM +0100, Thomas Schmitt wrote:
> Greg Wooledge wrote:
> > Let me write out the example again, but with the bug fixed, and then
> > explain what each line does, [... lecture about advanced shell
> > programming ...]
> 
> And this all because Gene Heskett was adventurous enough to buy a cheap
> fake USB disk. :))

Heh.  Don't forget your own attempts to use a shredder as a PRNG stream.

Shell redirections can be complicated, so this topic is going to
come up once in a while.  The example in the shred info page is fairly
unintuitive, so it deserves a bit of explanation.  I imagine most readers
who saw it simply accepted it as written, which is why the bug went
undiscovered for two decades.

[toc] | [prev] | [next] | [standalone]


#267367 — Re: shred bug? [was: Unidentified subject!]

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2024-02-13 20:40 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I76Nj-9Wha-3@gated-at.bofh.it>
In reply to#267365
Hi,

Greg Wooledge wrote:
> Heh.  Don't forget your own attempts to use a shredder as a PRNG stream.

My original idea was to watch a minimal shred run by teeing its work into
a checksummer.

But then topic drift came in. So we got a farm show of random generators
and a discussion about what exactly is a bug in shred's documentation.
Plus the shell programming webinar. And a diagnosis about a rightously
failed attempt to change the partition table type from MBR/DOS to GPT.

And this all because Gene Heskett was adventurous enough to buy a cheap
fake USB disk.


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#267366 — Re: shred bug? [was: Unidentified subject!]

Fromgene heskett <gheskett@shentel.net>
Date2024-02-13 20:40 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I76Nj-9Wha-1@gated-at.bofh.it>
In reply to#267363
On 2/13/24 12:56, Thomas Schmitt wrote:
> Hi,
> 
> Greg Wooledge wrote:
>> Let me write out the example again, but with the bug fixed, and then
>> explain what each line does, [... lecture about advanced shell
>> programming ...]
> 
> And this all because Gene Heskett was adventurous enough to buy a cheap
> fake USB disk. :))

Guilty as charged, Thomas. My advantage is that it won't affect the 
length of the ladder up my side of the hog.  If I save someone else from 
getting bit by that fraud I'm pleased.  Next experiment is a pair of 4T 
Silicon Power SSD's When they & the startech usb3 adapters arrive.  I'll 
get that NAS built for amanda yet.
> 
> 
> Have a nice day :)

You too.

> Thomas

Cheers, Gene Heskett, CET.
-- 
"There are four boxes to be used in defense of liberty:
  soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
  - Louis D. Brandeis

[toc] | [prev] | [next] | [standalone]


#267368 — Re: shred bug? [was: Unidentified subject!]

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2024-02-13 20:50 +0100
SubjectRe: shred bug? [was: Unidentified subject!]
Message-ID<I76WZ-9Wkv-5@gated-at.bofh.it>
In reply to#267366
Hi,

Gene Heskett wrote:
> Next experiment is a pair of 4T Silicon Power SSD's

When f3 has (hopefully) given its OK, the topic of a full write-and-read
test will come up again. I'm looking forward to all the spin-off topics.


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →

Back to top | Article view | linux.debian.user


csiph-web