Stories
Slash Boxes
Comments

SoylentNews is people

posted by cmn32480 on Monday April 17 2017, @08:34PM   Printer-friendly
from the people-that-live-in-a-bubble dept.

Edit: The link.

There were lots of good titles for this submission, as in "Breaking news: Poettering clueless?" to finally disprove Betteridge's law, or "systemd surprisingly not as good as advertised" or "Breaking new: systemd broken" or "Poettering censors critics after epic fail".

Systemd implementation of "rm -rf .*" will follow ".." to upper directory and erase /

How to reproduce:
        # mkdir -p /foo/dir{1,2}

        # touch /foo/.bar{1,2}

        # cat /etc/tmpfiles.d/test.conf

        R! /foo/.* - - - - -

        Reboot.

After the issue was fixed, finally Poettering added this gem of wisdom:

I am not sure I'd consider this much of a problem. Yeah, it's a UNIX pitfall, but "rm -rf /foo/.*" will work the exact same way, no?

The answer to this question, as many clarified for him, obviously is a loud "NO!". After being told a couple of times in no uncertain terms, the thread was closed for non-developers

poettering locked and limited conversation to collaborators 4 hours ago

for which I proposed the "freedom-of-speech" department (although I admit it is a weak proposal).


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 0) by Anonymous Coward on Tuesday April 18 2017, @12:19AM (7 children)

    by Anonymous Coward on Tuesday April 18 2017, @12:19AM (#495618)

    Okay, I'm really confused now. I once ran a "chmod -r +777 .*" in a silly attempt to change the property files of all the ".whatever" folders, and realized to my chagrin that it propagated up to "/". This was years ago, way before systemd was a thing.

    Am I to understand now that ".*" is not supposed to affect ".."? I quite dislike systemd, but is this behavior really a bug?

    Can somebody explain what is going on?

  • (Score: 2, Insightful) by Anonymous Coward on Tuesday April 18 2017, @01:23AM (4 children)

    by Anonymous Coward on Tuesday April 18 2017, @01:23AM (#495635)

    Modern implementations of rm have fail-safe in them that prevents recursing up the directory tree rather than down it.
    They special-case looking for the user to do something stupid like that and abort out. AFAICT there is no way to over-ride it in case you really meant to do it.

    But this isn't actually about rm, its about a command in systemd's own command-language that deletes files.

    • (Score: 2) by sjames on Tuesday April 18 2017, @03:42AM

      by sjames (2882) on Tuesday April 18 2017, @03:42AM (#495668) Journal

      If you really want it to ascend to / and then delete everything, just specify "-r /".

    • (Score: 2) by cubancigar11 on Tuesday April 18 2017, @05:48AM (2 children)

      by cubancigar11 (330) on Tuesday April 18 2017, @05:48AM (#495697) Homepage Journal

      I would also add that the special handling of '..' is a very recent development, relatively speaking.

      • (Score: 3, Insightful) by rleigh on Tuesday April 18 2017, @07:07AM (1 child)

        by rleigh (4887) on Tuesday April 18 2017, @07:07AM (#495728) Homepage

        I'm not so sure about that. Any implementation which doesn't handle '..' will recurse through every directory in the filesystem, and will likely never terminate because it has an infinite recursion between each parent and child. You *have* to handle '..' and '.' specially, and this isn't a recent development--it's been necessary since their invention. You'd notice this on the first invocation of your tool.

        • (Score: 2) by cubancigar11 on Tuesday April 18 2017, @10:38AM

          by cubancigar11 (330) on Tuesday April 18 2017, @10:38AM (#495776) Homepage Journal

          You may be right. I might be confusing rm with other utilities. But I distinctively remembering waiting a long time for tar to finish when I realized it is compressing the whole system.

  • (Score: 1, Insightful) by Anonymous Coward on Tuesday April 18 2017, @07:40AM

    by Anonymous Coward on Tuesday April 18 2017, @07:40AM (#495735)

    Okay, I'm really confused now. I once ran a "chmod -r +777 .*" in a silly attempt...

    Yep, I did a "chown -R [owner:group] .*" and learned the hard way it also ascends. I usually assume I'm the idiot but I think ascending is IDIOTIC behavior.

    Also did "rm -rf .*" once trying to get rid of .mozilla and other dot-prefixed files and directories. Did a very fast crtl-C when it didn't finish as fast as I expected.

  • (Score: 0) by Anonymous Coward on Tuesday April 18 2017, @02:37PM

    by Anonymous Coward on Tuesday April 18 2017, @02:37PM (#495863)

    https://linux.die.net/man/1/rm [die.net]

    --preserve-root
            do not remove '/' (default)