Possibly dangerous behavior of antiX, please can somebody confirm?

Forum Forums antiX-development Development Possibly dangerous behavior of antiX, please can somebody confirm?

  • This topic has 17 replies, 5 voices, and was last updated Jan 11-9:13 pm by Brian Masinick.
Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #128290
    Member
    Robin

      Just wondered where my file has gone I just had fetched via wget, but it was gone to nowhere (at least this was what it seemed to be like at first look)

      Steps to reproduce:

      – Create an empty folder somewhere on your hard disk.
      – Open a console window and cd to this folder.
      – In zzzFM now delete the very folder. (Sure, nobody would do this the very moment he has created and cd’d to it. But this can happen accidentally later on after having used the folder for some lengthy processing, and then doing the cleanup in zzzFM, while the terminal window is still in tray.)
      – Go back to terminal window waiting in tray or in background, and from within the very window (without cding to somewhere before) do:
      - wget 'some-huge-file-here'

      My findings:
      The file is obviously downloaded and wget doesn’t complain about target folder not found. Even if the current folder doesn’t exist at all (since we have deleted it in zzzFM)
      After download has completed, type ls in the (actually non-existant) folder in this terminal window. Result: The file is displayed as present in this folder, even by stat:

      Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
      $ ls
      3044285_55417751.mp4  urn:ard:subtitle:752b127893c8590e
      Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
      $ stat 3044285_55417751.mp4
       Datei: 3044285_55417751.mp4
       Größe: 3232805266	Blöcke: 6314088    EA Block: 4096   reguläre Datei
      Gerät: 8/4	Inode: 4458552     Verknüpfungen: 1
      Zugriff: (0644/-rw-r--r--)  Uid: ( 1001/  Robin)   Gid: ( 1001/  Robin)
      Zugriff: 2024-01-07 10:27:21.000000000 +0100
      Modifiziert: 2023-12-31 13:40:51.000000000 +0100
      Geändert: 2024-01-07 10:27:21.714848401 +0100
      Geburt: 2024-01-07 09:28:33.541632105 +0100
      

      Please note: There is not folder /media/sda4/Arbeitsordner/Video/Kassettenkinder on my disk, it was deleted before starting wget.

      Go back to zzzFM window to find the parent folder “Video” empty, it doesn’t contain the subfolder “Kassettenkinder”. Yes, there is no folder in which you supposedly have started wget from, and no file wget has proven to have downloaded by it’s progress bar for more than half an hour from the public ARD-Mediathek servers. And no folder ls and stat have reported the file to be present in. Really confusing.

      Ok, since I remembered having deleted the folder the evening before, I would expect to find the file now in trash possibly (somewhere it must have gone, wget transported the bits to somewhere for half an hour)
      – Click the trash entry from zzzFM’s bookmarks.

      Huhh… the file is not there. Has it been stored to /dev/null ?

      So I tried to find out where the file could have been gone. If it had gone to /dev null it wouldn’t be reported by ls and stat with all the details.
      ls -l ..
      Merely to find literally hundreds of files in the same folder, some of them pretty huge in size. None of them were shown in zzzFM. Ghost files? Nope. After some searching with console tools like “find” I found out all these files are actually stored in trash on the hard disk, but not shown by antiX trash function in zzzFM file manager.

      And to make the confusion complete, the current folder focus in console window moves itself silently to this trash folder without changing the line displayed, if the current folder was deleted in zzzFM or from within another terminal window. It still reads like the meanwhile non-existing folder, operates as if the folder still was present, and prints this nonsense again and again after each command you file into this window. This way unexpected results can yield, what I consider to be dangerous potentially. Some real work might get lost.

      Please, could this confusing behaviour get fixed for antiX 23.1 ?
      Or is this something merely happening to me, not reproducible on other machines? So please could somebody confirm whether this happens also on other Live antiX 23 or Frugal installs?

      (If this is an issue on my Live systems merely, then sorry for the trouble. But if happens to everybody, it should be fixed)

      Windows is like a submarine. Open a window and serious problems will start.

      #128308
      Member
      Robin

        Some additional findings:

        Create a new folder of the same name as the formerly deleted one in the original position at disk from within zzzFM or another console window)

        From within the still opened first terminal window all file operations pointing to ./ result in sending all new files directly to trash instead to store them in the displayed folder (luckily it’s not /dev/null).

        Example:

        Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
        echo test > test.txt

        You’d expect to find this file now in the folder Kassettenkinder. But it’s not there, actually it was created directly in trash instead, even when the deleted folder was restored beforehand in zzzFM.

        Windows is like a submarine. Open a window and serious problems will start.

        #128309
        Member
        Robin

          Without words.

          Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
          $ cd ..
          Robin@eiche:/media/sda4/.Trash-1001/files

          ???

          • This reply was modified 6 months, 1 week ago by Robin. Reason: typo

          Windows is like a submarine. Open a window and serious problems will start.

          #128324
          Member
          anti-apXos

            This is just the way Linux file systems work, not something zzzFM has introduced. As a test, repeat your procedure, but instead of using zzzFM to “delete” the folder, open another terminal and use ‘mv’ to move it. You should see all the same results as you described.

            Ok, since I remembered having deleted the folder the evening before, I would expect to find the file now in trash possibly (somewhere it must have gone, wget transported the bits to somewhere for half an hour)
            – Click the trash entry from zzzFM’s bookmarks.

            Huhh… the file is not there.

            This is the part that would be unexpected. The moved folder should be wherever you moved it (your Trash location, in this case) and any files that were subsequently created in it should be there in the new location.

            I cannot reproduce what you describe in this case, though. The folder is in Trash for me and the created file is inside it.

            But it’s not there, actually it was created directly in trash instead, even when the deleted folder was restored beforehand in zzzFM.

            I think this terminology may be what’s causing your confusion. When you say “delete” you really mean “move to the trash folder” (note that zzzFM uses basically this terminology itself in the context menu). Similarly, if you create a new folder with the same name in the old location, that’s not really “restoring” it. From the file system’s point of view, it’s an entirely new and different directory. The way to actually restore the folder would be to move the original back from the Trash location to where it was before, which is what the “Restore” option in zzzFM does.

            #128349
            Member
            anti-apXos

              Without words.

              Robin@eiche:/media/sda4/Arbeitsordner/Video/kassettenkinder
              $ cd ..
              Robin@eiche:/media/sda4/.Trash-1001/files

              ???

              I only just looked more closely at this post and now I think I understand why you didn’t find your downloaded file when you clicked on Trash.

              The location here shows you’re doing this on an external partition, which means it will have its own separate Trash location. When you click the Trash button in zzzFM, though, it always opens the Trash location in your home partition.

              So that part is a zzzFM issue, in fact. I don’t know what would be the best solution, though. zzzFM is highly customizable, but I don’t know if there’s a way to change bookmark targets based on context…or even if zzzFM could realistically know which Trash folder you wanted to open if you have several mounted drives. I guess it could just open all of them or maybe give you separate Trash bookmarks for each mounted drive?

              Honestly, this is part of why I hate “Trash folders.” On my own system, I prefer to just truly delete things if I don’t want them and leave them where they are if I’m unsure. Trash folders always seem like more problem than help to me.

              #128437
              Member
              anti-apXos

                I guess it could just open all of them or maybe give you separate Trash bookmarks for each mounted drive?

                I decided to give a try at this and it was fairly easy…in the end.

                If anyone wants to modify the ‘Trash’ bookmark in zzzFM, so that it opens Trash folders for all mounted drives, here’s a way:

                Right-click the current ‘Trash’ bookmark and from the context menu select ‘Properties’.

                On the ‘Menu Item’ tab of the properties window, change the ‘Type’ to ‘Command’. Optionally, you might also want to change the ‘Name’ here just as a reminder that you made a change. I renamed mine to ‘All Trashes’.

                Next, change to the ‘Command’ tab of the properties window and enter the following commands in the box there:

                zzzfm ~/.local/share/Trash/files
                find /media -type d -name .Trash-* -exec zzzfm '{}/files' \;
                

                The first line opens a zzzFM tab for the regular Trash folder in your home partition, like the old bookmark did. The second line searches for Trash folders in /media and opens tabs for any it finds. I think mounting in /media is standard for zzzFM/antiX, but if you mount additional drives somewhere else, this command won’t find their Trash folders. You could add additional starting locations to the find command after ‘/media’ if you want them.

                Finally, go to the ‘Options’ tab of the properties window and uncheck ‘Run As Task’. This will prevent popups about permissions if there are directories in /media that the find command can’t access, like root-owned locations.

                That’s it. Click ‘OK’ and your Trash bookmark should be a bit more functional now.

                Like I said, I don’t use Trash much, but maybe this change will make me more likely to in the future since it should be easier to keep track of what ends up where and not just fill up my drives with all kinds of things in Trash that I forget about.

                #128456
                Member
                stevesr0

                  Hi anti-apXos,

                  I just attempted to follow your instructions (pick a file in zzzfm, right click to display the menu, right click on the trash option, s elect edit command, which opens a window and paste your two line script in place of the original listing (%F, I think).

                  Then, I attempted to send a file to the trash directory. But when I now select “Trash Can”, the zzzfm window shifts to the trash directory, instead of sending the file to the trash directory. The files don’t get deleted or moved from their original location.

                  I imagine that I have done something wrong or was starting from a different version of the trash can…

                  #128467
                  Member
                  Robin

                    note that zzzFM uses basically this terminology itself in the context menu

                    You are true, but it’s not about terminology here.

                    Actually this strange and confusing thingy I’ve described rises from coincidence of two different issues in two places. Firstly there is the antiX trashbin not showing all files and folders which have been sent to trash by user before, as you also found.

                    I guess it could just open all of them or maybe give you separate Trash bookmarks for each mounted drive?

                    Either methods sound like a reasonable solution. Since zzzFM moves the files and folders to these other places, you’d expect to get them presented when clicking on the trashbin entry, like your modification targets at (sorry, have not had time to test it before writing this answer, seeing your latest reply only just right now).

                    But the second issue, in my eyes the more severe, is our console window lying (or even losing track, not sure about what applies here) about the actual current folder when it is moved or deleted:

                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls
                    3044285_55417751.mp4  urn:ard:subtitle:752b127893c8590e
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls ../Kassettenkinder
                    3044285_55417751.mp4  urn:ard:subtitle:752b127893c8590e
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls ../
                    Kassettenkinder
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ rm -r ../Kassettenkinder
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ echo test2 > test2.txt
                    bash: test2.txt: Datei oder Verzeichnis nicht gefunden
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls ../
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ mkdir ../Kassettenkinder
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls ../
                    Kassettenkinder
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls ../Kassettenkinder
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ echo test2 > test2.txt
                    bash: test2.txt: Datei oder Verzeichnis nicht gefunden
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ echo test2 > ../Kassettenkinder/test2.txt
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls ../Kassettenkinder
                    test2

                    This is completely inconsistent behaviour, taken into account our console window makes us believe current folder is Kassettenkinder all the time.

                    What is actually the current folder after removing it?
                    Where does the this command try to create the file?

                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ echo test2 > test2.txt
                    bash: test2.txt: Datei oder Verzeichnis nicht gefunden

                    The line reads we are still in a folder reading Kassettenkinder, while we know this folder doesn’t exist.

                    And what’s that? Supposedly we are in folder Kassettenkinder.

                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ echo test2 > ../Kassettenkinder/test2.txt
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls

                    But:

                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls ../Kassettenkinder
                    test2

                    So in which folder are we operating actually here? Clear to me is merely it’s not the folder like the line in console window reads. There must be some other place where we operate currently in. And this crucial piece of information is not reflected in any way by that line.

                    Even worse when the folder was moved:
                    Then there is no indication the file is not created in the expected place:

                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ cd ../Kassettenkinder
                    chdir: Kann das aktuelle Verzeichnis nicht wiederfinden: getcwd: Kann auf die übergeordneten Verzeichnisse nicht zugreifen.: Datei oder Verzeichnis nicht gefunden
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls /media/sda4/Arbeitsordner/Video/Kassettenkinder
                    test2
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ cd ../Kassettenkinder
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ ls
                    test2

                    This behaviour looks to me completely inconsistent.

                    And now. That’s topping it:

                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ rm -r ../Kassettenkinder
                    Robin@eiche:/media/sda4/Arbeitsordner/Video/Kassettenkinder
                    $ cd ..
                    Robin@eiche:..
                    $ cd ..
                    Robin@eiche:../..
                    $ cd ..
                    Robin@eiche:../../..
                    $ cd ..
                    Robin@eiche:../../../..
                    $ cd ..
                    Robin@eiche:../../../../..
                    $ cd ..
                    Robin@eiche:../../../../../..
                    $ ls
                    bin  boot  dev  etc  home  lib  lib32  lib64  libx32  live  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

                    Seems in this place a command like “whereami” analogue to “whoami” would come in handy, obviously the console completely has lost track of what the wording of the command “whoami” implies: »Who Am I? And If So, How Many?« … Where am I, and if so… Am I at all?
                    It’s like “whoami” would return instead of your login name something like “If you don’t know this I can’t help you either! Besides: You don’t really want to learn that about yourself.”

                    This is something a new to antiX (or new to Linux in general) user won’t ever sort out… So I guess it should be fixed.

                    • This reply was modified 6 months, 1 week ago by Robin.

                    Windows is like a submarine. Open a window and serious problems will start.

                    #128471
                    Member
                    PPC

                      Thanks for reporting this problem.
                      I know it’s not something that affects many users – Robin may be the single one among thousand that deleted a folder and then used the cli to download a file to the deleted folder… but it’s a problem.

                      Let me explain something about zzzfm and the Trash can/Recicle bin – zzzfm does not include it. It is only through several changes in it’s config files, and the inclusion of scripts that zzzfm can use a trash can- it was my idea, and anticapitalista choose to implement it, since many users complained about not having a trash can in antiX, and it was a relatively easy feature to implement, that has no extra cost on system resources.
                      When users choose to send a file to the trash can, it’s done using a cli app, that moves the file to the trash folder (it seems each drive has it’s own trash folder- as far as I recall I developed the scripts in computers that have only 1 drive, so I had no way to test for that possibility) and a text file is generated, that includes the place of the file inside the trash folder and it’s original name and place (so it can be “undeleted” or restored from the trash to where it used to be).
                      I can’t test it, since I have only 1 drive, but the solution to display both the home’s trash folder AND any other existing trash folder should be ideal.

                      EDIT: I don’t have more than one hard drive, so I tried to test this idea with a USB flashdrive- 2 folders opened when I clicked the new trash bookmark that I created – the one inside the home partition and one (that I did not even knew was there, inside the flashdrive- this last one opened but displayed an error about lack of permissions).

                      I just attempted to follow your instructions

                      If you read carefully, the instructions where to edit the Trash BOOKMARK – this means the bookmark displayed in the bookmarks list, on the place bookmarks are shown, on the left column of zzzfm. Did I say bookmark enough times so you notice what I mean? You did the worst possible thing- edited out the code that sent files to the trash can, instead, because you edit the “Send to trash” contextual menu.

                      P.

                      • This reply was modified 6 months, 1 week ago by PPC.
                      #128509
                      Member
                      anti-apXos

                        @stevesr0
                        Like PPC said, this modification is for the BOOKMARK to your Trash folder, not for the “Move To Trash” option in a file context menu.

                        The original command for the Move To Trash entry you changed might have been

                        folder=%d; if [[ ${folder} != *".local/share/Trash/files"* ]]; then trash %F; fi
                        

                        EDIT: curly braces

                        @Robin
                        I don’t know if this is technically true, but it works to think of your current location in the terminal in this case as a sort of temporary symbolic link that points to wherever you moved the folder using another program. The symlink only exists until you close the terminal or ‘cd’ to somewhere else.

                        Remember that in reality data is somewhat haphazardly arranged on a drive and the file system just keeps a set of pointers to give users the illusion of organization.

                        Seems in this place a command like “whereami” analogue to “whoami” would come in handy,

                        There is such a command. ‘pwd’ prints the working directory. It will show the same info as the terminal prompt in this case, though. If you use ‘pwd -P’ to resolve symbolic links, it should show that you are “actually” working in your Trash location.

                        EDIT: In fact, editing your ~/.bashrc file so that it uses ‘pwd -P’ to construct the command prompt in your terminal would give you the result you want in this case of showing the “actual” location of a trashed folder. In other situations, when dealing with true symlinks, that might not be desirable, though.

                        @PPC
                        The permissions error comes from the ‘find’ command trying to search through /media, not from opening the Trash folder on your USB drive, which should work fine.

                        If there’s directories in /media that your user doesn’t have permission to access, you won’t be able to look in them, even though another user, such as root, may have mounted something there. Unchecking “Run As Task” in the Options for the bookmark will prevent the permissions popup.

                        • This reply was modified 6 months, 1 week ago by anti-apXos.
                        • This reply was modified 6 months, 1 week ago by anti-apXos.
                        • This reply was modified 6 months, 1 week ago by anti-apXos.
                        #128610
                        Member
                        stevesr0

                          Hi PPC,

                          You seem to have been irritated by my ignorance. Sorry about that. The trash program did work in the past (I have several test files in /home/stevesr0/.local/share/Trash/files from the time I installed it).

                          Now it is mucked up. Since I rarely have used it (this not being my primary functional system, rather a test Sid system), I may give up on it at this time.

                          Hi anti-apXos,

                          Thanks for the code suggestion. An error window opened complaining
                          /tmp/zzzfm-stevesr0-69dce99a.tmp/4ff88aa4-tmp.sh: line 99: folder: command not found

                          There is no script file in the tmp/zzzfm-stevesr0-69dce99a.tmp directory. Two subdirectories are listed (stevesr0 and root) but when I try to display the contents of stevesr0, the response is there is no such directory.

                          #128614
                          Member
                          anti-apXos

                            @stevesr0 Sorry, my mistake, those should have been curly braces around ‘folder’ in that command.

                            folder=%d; if [[ ${folder} != *".local/share/Trash/files"* ]]; then trash %F; fi
                            
                            • This reply was modified 6 months, 1 week ago by anti-apXos.
                            #128664
                            Member
                            stevesr0

                              Thanks anti-apposition,

                              I will edit that and see if it works.

                              I will follow-up later.

                              #128666
                              Member
                              PPC

                                You seem to have been irritated by my ignorance. Sorry about that.

                                Not at all. I noticed what you did wrong and tried to use humor to point that to you. We all make mistakes. Sometimes, in computers, people make mistakes that most people wonder how someone can think about doing that. Mistaking a bookmark by a contextual menu entry was one of those cases that got me wondering about how each mind works in a different way.
                                Sorry if I sounded obnoxious, trust me, it was not my intention.

                                #128740
                                Member
                                stevesr0

                                  Hi anti-apXos,

                                  Yes, with the substitution of curly for curved brackets, the code works. This system is a minimalistic Sid and doesn’t have the nice Bookmarks column or anything in /etc/skel except a Desktop directory. Thank you.

                                  Hi PPC,

                                  All is fine. I appreciate that it is a lot of work to create the stuff AND then support sometimes clueless users. I mentioned in the newer thread that I was able to install the Trash setup following your instructions to Kempelen. Very neat. Thanks.

                                Viewing 15 posts - 1 through 15 (of 18 total)
                                • You must be logged in to reply to this topic.