Can’t find source of unplugdrive

Forum Forums antiX-development Development Can’t find source of unplugdrive

  • This topic has 17 replies, 6 voices, and was last updated May 8-9:55 am by Robin.
Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #57899
    Member
    AvatarRobin

    Hi all,
    Since I had promised I’d take care of some nasty bugs in recent unplugdrive, not long ago, I have started to fix the most pressing issue (which was presenting false success messages to the user even when partitions were left behind in mounted state, so user has to face data corruption when trusting in this.) I have traced down the conditions under which this error occurs, and have a first fix ready for upload meanwhile.
    Unfortunately I can’t find unplugdrive in antiX on gitlab, so I can’t fork, upload fix and create a merge request. @anticapitalista (or somebody else), please let me know where it is hidden.

    Attatched my first approach to fix the issues; I’m about to fix the remaining ones as well. But would be glad to get some feedback whether it works on pcs other than mine old-as-the-hills-32bit-steamer also 🙂

    So long
    Robin

    • This topic was modified 3 weeks ago by Robin.
    Attachments:
    #57902
    Forum Admin
    anticapitalistaanticapitalista

    Here it is, under antix-goodies.

    antix-goodies

    Philosophers have interpreted the world in many ways; the point is to change it.

    antiX with runit - leaner and meaner.

    #57903
    Member
    XecureXecure

    For the future (and for anyone interested in how to figure this out).

    How to discover tha package for a certain script or binary

    0. If you want to know where the script/binary is located based on the command used (not your case, as you already know)
    command -v <command-name>

    1. Discover what packages installed a specific file using its path
    dpkg -S /path/to/file
    or just using the file name (no need for step 0)
    dpkg -S file-name

    Example:

    $ dpkg -S /usr/local/bin/unplugdrive.sh
    antix-goodies: /usr/local/bin/unplugdrive.sh

    Now you know it belongs to the package antix-goodies.

    The antix-goodies repo in git:
    https://gitlab.com/antiX-Linux/antix-goodies (aready reported by anticapitalista)

    Fork this project, change the desired files (or using the online web-based editor or cloning to your computer, editing the files, and pushing the changes), and create a merge request with the fix to the original repo, explaining what you have changed (just a few words for each important change).

    Then, wait for the devs to check the changes and accept them.

    #57904
    Member
    AvatarRobin

    Many thanks, both of you, anticapitalista and Xecure.
    Actually I did know all of the commands you’ve explained above already. But I’d never have had figured I’d get the source of a program that way, since I didn’t reckon to find it in another package than unplugdrive. That’s good to know.

    • This reply was modified 3 weeks ago by Robin.
    #57906
    Member
    rayluorayluo

    @marcelocripe, the other day I replied to your question about how to share a script to antix community:

    all those are essentially programs, so, a git-based program hosting website would be the best fit: github, gitlab, bitbucket, etc.. The source code of antiX seems to already be hosted on gitlab, by the way.

    However, the intrinsic learning curve of the git, is definitely much more complicated than a “file-sharing” website. That is probably why @marceloripe “found it very difficult to use this service”.

    Now, the message from Xecure, is a guidance of how to do that in antix’s own repo.

    The antix-goodies repo in git:
    https://gitlab.com/antiX-Linux/antix-goodies (aready reported by anticapitalista)

    Fork this project, change the desired files (or using the online web-based editor or cloning to your computer, editing the files, and pushing the changes), and create a merge request with the fix to the original repo, explaining what you have changed (just a few words for each important change).

    Then, wait for the devs to check the changes and accept them.

    #58256
    Member
    AvatarRobin

    A week or more has gone by since I had uploaded the fixed script for testing before submitting a merging request. Did anybody have had an occasion to check it out meanwhile?

    There are two ways of downloading by now. Either from the bottom of the starting post of this thread as a tar.gz archive, or directly from the Gitlab-repo

    What is it, which has to be checked?

    1.) If you can make it, please check the script using different usb-devices and combinations of these, and without any unpluggable device also. Try to add additional mountpoints for a specific device manually. You may test mountpoints containing any special characters except for blanks by now. This is important, since I came across some USB-Sticks which were mounted automatically to something like “/media/demo/sdd4-usb-256MB_USB2.0Flas” The script as it was before wouldn’t properly unmount these due to the underscore in its name. Please check always manually, whether every partition was unmounted after script returns success message in every single case. This was the main bug I hopefully succeded to eliminate: The false success messages.

    2.) Another point of interest is whether all devices checkboxes in dialogs are visible now, not any longer hidden out of reach, and not too much free space below them. The space needed is calculated by a simple formula, and may not work on all graphics adapters the same way, I can’t foresee. On my hardware it was proven to work with any number of unmountable drives.

    3.) Do the different commandline flags work as expected? Check -h first to get an idea which additional options exist. You may call it drawing borders or not, and in secure mode also. All dialogs except for the really important ones should close after some seconds automatically. These informational windows shouldn’t display buttons. Check also whether script will exit on ESC button and “X” in upper window corner (the latter only in case of borders). Do the buttons manage correctly the workflow always?

    4.) In case something does not work as expected for you, please post output from -g option (for debug output in terminal) and a screenshot of the malfunctioning dialog.

    I have done all these testings on my equipment already, but need to know whether it is reliable also on other PC configurations, particularly on 64 bit. When everything is proven to work, please let me know, so I can create the corresponding .pot and .po files containing the modified strings and upload them to gitlab before filing the merge request to anticapitalista.

    Many thanks for your support!
    Robin

    • This reply was modified 1 week, 6 days ago by Robin.
    #58260
    Member
    Avatarskidoo

    >>> particularly on 64 bit

    We can reasonably expect this bash script will perform identically on a 64bit system.

    A removable drive with a mounted
    partition was not found.
    It is safe to unplug the drive(s)

    Okay, but after I unplug the drive that doesn’t exist, should I upgrade my megahurtzes and try again?

    [ -e $TEMPFILE ] && rm -f $TEMPFILE

    ? ? ?
    Whew, thanks. That darned tempfile has been taking up space for weeks,
    ever since I ran the earlier version of this script.

    In case something does not work as expected for you

    The current version of the script still presumes a laissez faire, permissive, mount policy is in effect. It should check, and fail gracefully, eh? (display an explanatory dialogbox)

    #58265
    Member
    AvatarPPC

    I unplug the drive that doesn’t exist

    LOL, I thought about that when I tweaked the script… – in a strange way it makes sense- you can have a device that’s pluged in but not mounted (because mounting failed, or you already ejected it hours/days ago and forgot about it)
    But you are right, maybe the message could be:

    A removable drive with a mounted
    partition was not found.
    You can safely unplug any removable usb drive(s)

    @Robin – sorry I haven’t tested your script…(I’ll try do so today)
    But I’m eager to have localized versions out on the open 🙂
    Nice work!

    Edit: I still haven’t tested your script, but had a cursory look at it- only the part I really understand well- the yad windows…- well I noticed you use both –center and –mouse options. In that particular case, the second option does nothing… The “–mouse” part was my “inovation”- so the windows would pop up next to the mouse, not a random position (my reasoning was that users click the eject button on the toolbar, so it makes sense that they don’t want to drag their mouse too far just to click the drive they want to eject). I think there’s a yad option to always force the window to be on top (so they don’t get lost between other windows): “–on-top”

    P.

    • This reply was modified 1 week, 6 days ago by PPC.
    #58300
    Member
    AvatarRobin

    A removable drive with a mounted
    partition was not found.
    It is safe to unplug the drive(s)

    Okay, but after I unplug the drive that doesn’t exist, should I upgrade my megahurtzes and try again?

    This is meant for covering the case a device is plugged but not mounted for some reason, as PPC has already pointed out:

    you can have a device that’s pluged in but not mounted

    We can discuss whether script should display a message here or silently ignore and close (probably causing the user thinking about malfunction when left without information) Also you’ll probably be able to find better wording for the message, this goes for all the messages (but I didn’t rewrite much in the messagestrings aside from formatting).

    [ -e $TEMPFILE ] && rm -f $TEMPFILE

    ? ? ?
    Whew, thanks. That darned tempfile has been taking up space for weeks,
    ever since I ran the earlier version of this script.

    Yes, you are right. This can get removed from code again since there is no tempfile in use anymore. I had added the cleanup function right when starting with editing the code, and at that state there was a tempfile still present. Since It doesn’t do any harm I have left the cleanup function for now (in case it turns out during the tests we need a tempfile) while only commenting out its definition variable.
    Would you suggest to remove the complete function ‘cleanup’ and all its references from the code (causing the same trouble again when it turns out something is actually to be cleaned up on exit some day), or simply put a NOP inside?

    In case something does not work as expected for you

    The current version of the script still presumes a laissez faire, permissive, mount policy is in effect. It should check, and fail gracefully, eh? (display an explanatory dialogbox)

    Suggestions? What and where can I get Information about mount policies in effect on running antiX system? If I know what to look for, I’ll find a way to put it in the script.

    the second option does nothing… The “–mouse” part was my “inovation”- so the windows would pop up next to the mouse,

    Would you like to have an additional commandline option (“-m open windows near mouse cursor instead of center of screen”)? This would be easily to be done, and so user could decide which behaviour they prefer. At least now I do understand why windows popped open in random places for me: I am used to not following permanently the mouse cursor with the eyes, only focusing it the moment it is actually needed. So I normally don’t care where it is on screen, resulting to open the dialogs randomly with your setting. I don’t have to make big movements with the mouse either, due to adaptive acceleration. When accelerating fast, mouse cursor will move a long distance on a small movement. When only accelerating slowly, mouse cursor moves very little only when moving the mouse the same distance. So I don’t care about focusing my mouse cursor to find the location where a dialog will open, rather expecting it to find associated windows allways in the same place.
    Best would be: Open the first dialog near your cursor, and opening the following dialogs in this place also. I believe yad can be told to use the coordinates of the first dialog for all the following windows, but still I don’t know enough about yad to figure this out. Mybe you know about this feature?

    But I’m eager to have localized versions out

    Language files will follow as soon as possible.
    Given the original strings in script won’t change anymore, you could start filling in the freshly created po-files already. I’ve attached them compressed to an archive (.tar.gz) below.

    • This reply was modified 1 week, 5 days ago by Robin.
    #58305
    Member
    AvatarPPC

    Would you like to have an additional commandline option (“-m open windows near mouse cursor instead of center of screen”)?

    I was thinking the other way around, something like “-c option to always open windows in the center of the screen”, since the “open windows on mouse position” is the current default setting, but I’m good either way, whatever most folks like, I’ll roll with it [one idea: I considered using a formula to calculate the current resolution max y and z positions, so I could place this scripts informative windows- not the one that allows users to select the drive to eject- always on the lower right section or the the upper right section of the screen- making them look like “system notifications”, without really having to use system notification).

    I’ll try to translate the po files, I already translated the original script itself for my own personal use…

    P.

    • This reply was modified 1 week, 5 days ago by PPC.
    #58306
    Member
    AvatarPPC

    Pt-pt language file ready!
    Since the forum won’t let me upload it, not even in a compressed file, here it goes:

    https://pastebin.com/A9MTA85J

    P.

    Edit:
    I just noticed, if zzfm and this unplugdrive script are included in antiX 21, I guess all the OS file management tasks are now fully localized/localizable…
    This means that basic users can perform the most used tasks in their own language…

    • This reply was modified 1 week, 5 days ago by PPC.
    #58317
    Member
    AvatarRobin

    Many thanks PPC,

    I’ve converted your translation to .mo type of file manually and uploaded to gitlab: Portuguese unplugdrive.sh.mo (0.82)
    You can download from there and check whether everything translates fine with this .mo file when using unplugdrive script (ver. 0.82) in original. If so, we can use the .pot file as a template for transifex.
    The pot file now can get downloaded from gitlab, unplugdrive.sh.pot (ver. 0.82).

    The files on gitlab contain some supplemental meta information, so please use these for download rather than the tar.gz from above.

    Update: Meanwhile on transifex (antix-contribs), many thanks Xecure!

    • This reply was modified 1 week, 5 days ago by Robin. Reason: Updated transifex information
    • This reply was modified 1 week, 5 days ago by Robin.
    #58326
    Member
    AvatarPPC

    @Robin – I forgot my pendrive at home, but the -h is showing the correct pt text, so is the “no device found” message, so I guess, there’s no serious problem with the translated file. Marcelo will love this one…

    P.

    • This reply was modified 1 week, 5 days ago by PPC.
    #58674
    Member
    AvatarRobin

    I was thinking the other way around, something like “-c option to always open windows in the center of the screen”

    New version 0.82a is out on gitlab, which features this option. One additional string to translate on transifex. ( @Wallon : Please check my fr_BE translation of this string…)

    The resulting .mo files can always be found in the subdirectories of https://gitlab.com/Robin-antiX/antix-goodies/-/tree/master/locale. For now there are present fr_BE, pt and de. More to come soon.

    Keep in mind, unplugdrive still can’t handle mountpoints containing a blank (Marcelo faced exactly this while testing 0.82). But at least now it informs correctly when any mountpoints are still present for a device, keeping user from unplugging before it is really safe. This “blank” issue will get fixed in one of the next major updates (probably 0.84)

    For 0.83 I’m working on a freshly discovered bug related to rotational devices: User is told it was safe to unplug, whereas devices are happily spinning after unmounting… This is NOT safe. Never simply plug them off in this state!
    Unplugdrive 0.83 will come with this being fixed by checking whether a device is rotational, and making it spin down before user gets informed it is safe to unplug.

    @anticapitalista: Would you prefer to get merge requests for every minor version update separately or rather a cumulative request when all pending bugfixings are done?

    #58908
    Member
    AvatarRobin

    New buxfix Version 0.82b of unplugdrive on gitlab.

    Fixed in 0.82b:
    – unfounded “Error: could not determine real path of the device” messages.
    – pumount mixes up mount points that relate to the same partition, causing unmounting process to fail.

    Changes:
    replaced „pmount” by „umount” command for actual unmounting devices.

    This bugfix has a side effect: user needs to enter sudo password now, since umount in contrast to pumount doesn’t accept normal users.
    But it is simply impossible to get consistent behaviour from pumount.

    Strings for translation don’t change from 0.82a.

    Please be carefully using recent and all former versions of unplugdrive on rotational devices, they still do not spin down. Next Version 0.83 will fix this.

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