udisks icon indicating copy to clipboard operation
udisks copied to clipboard

Regarding polkit authorization prompts

Open itsXuSt opened this issue 8 months ago • 5 comments

https://github.com/user-attachments/assets/5916c152-27fc-48dc-8b73-780d9fb4620a

Regarding polkit authorization prompts, when udisks determines that an operation on a partition requires user authorization, the device name is displayed using the drive name + device descriptor format. However, this approach is somewhat counterintuitive. Users are interacting with a partition rather than the entire disk, and average users may not understand the origin of the displayed disk name.

To improve clarity, we propose the following adjustment:
• If a partition has an idLabel (e.g., a user-defined label), display the device name as idLabel (device descriptor).
• If the idLabel is empty, retain the original display format (drive name + device descriptor).

This change would align the prompt with user expectations and reduce confusion. For a practical demonstration, please refer to the example video.


Key Points:

  1. User-Centric Terminology: Use partition labels (idLabel) when available, as they are more recognizable to users.
  2. Fallback Mechanism: Maintain backward compatibility for partitions without labels.
  3. Clarity: Explicitly distinguish partitions from their parent disks in authorization prompts.

itsXuSt avatar Mar 10 '25 03:03 itsXuSt

@tbzatek could you please check this, if it's acceptable, I can make a PR.

itsXuSt avatar Mar 10 '25 03:03 itsXuSt

Could you provide udisksctl dump and gio mount -l please?

I believe this should be consistent with what gvfs-udisks2-volume-monitor presents, as much as possible. As the labels can be duplicate, I believe displaying device file is still a necessity. Cc: @ondrejholy

This is the code in question in gvfs: https://gitlab.gnome.org/GNOME/gvfs/-/blob/master/monitor/udisks2/gvfsudisks2volume.c?ref_type=heads#L292-L327

So yes, I agree with your proposal, it should just distinguish different volume types.

Btw. are you running a desktop session as root?! (/run/media/root/)

tbzatek avatar Mar 10 '25 15:03 tbzatek

gio_mount_l.txt udisksctl_dump.txt Hi @tbzatek , here are logs.

I understand what you say, and I'll modify the code and push later, and maybe I should remove all the *.po changes.

I'm not running desktop session as root, but just mounted the partitions by root user so that the polkit dialog could be raised to show the changes when I unmount them by another user.

itsXuSt avatar Mar 11 '25 01:03 itsXuSt

Image Image Hi @tbzatek , I have tested the modify on latest debian trixie, and the code has been pushed. Could you please review it and give some advise or allow me to merge it? https://github.com/storaged-project/udisks/pull/1363

itsXuSt avatar Mar 13 '25 02:03 itsXuSt

Thanks for the screenshots, looks good to me.

tbzatek avatar Mar 19 '25 15:03 tbzatek