著者: Didier Kryn 日付: To: dng 題目: Re: [DNG] New application ready to test: hopman
Le 24/04/2019 à 20:43, Steve Litt a écrit : > On Wed, 24 Apr 2019 09:05:12 +0200
> Didier Kryn <kryn@???> wrote:
>
>> Le 24/04/2019 à 01:05, Evilham via Dng a écrit :
>>> Am 24. April 2019 00:24:56 MESZ schrieb Steve Litt
>
>>> 3. Document the misbehaviour when users... Misbehave (okay, that
>>> was a bad joke).
>> There's an infinite number of ways a human can misbehave. For
>> brutal extraction of the media, I don't think it is easy to
>> characterize.
> There's a way. There can be a "superumount" that acquires a root
> password and keeps doing umount until it's really unmounted on all
> lists like mtab.
/etc/mtab is userspace only and is optionaly bypassed by mount;
it's unreliable. Two pseudofiles are maintained by the kernel:
/proc/self/mounts and /proc/self/mountinfo. The last is also the newest
and contains more information; this is the one which is checked
periodically by hopman. You can perfectly verify this by invoking
pmount/pumount from the command-line while looking at hopman's display.
The periodicity of these checks is set in the config file; it is 5s by
default. Hopman does not rely on its interactions with the user to know
the status of the filesystems; instead it reads all it shows from /dev,
/sys and /proc. After a mount or umount command has been selected in the
menu, then, of course, hopman doesn't wait 5s to check the result, but
it shows only what the kernel reports.
When you select unmount on hopman's menu, hopman invokes pumount,
and pumount eventually calls umount(). If some process is accessing the
mount point or any file or directory in the directory tree below the
mountpoint, umount() returns -1 and sets errno to EBUSY (man 2 umount).
At this point, I guess pumount prints strerror(errno) which is equal to
"Device or resource busy". Then hopman detects that pumount exited with
an eror code and hopman reads the message that pumount has printed on
its stderr and shows it in a pop-up window. But hopman does not devise
the existence or status of partitions from the result of pumount or any
helper command.
I am surprised that you can select unmount on hopman's menu for a
partition on a device which has been removed, because the hotplugger
should have deleted the corresponding device file and, therefore, hopman
should have removed it immediately from its display. Did you open the
menu and then extract the device before clicking the menu entry ?