Subject: bug#64445: 30.0.50; Android: Emacs cannot access /storage/emulated/0 although other apps can

From: Milan Zamazal <[email-masked]>
Date: Tue, 04 Jul 2023 10:05:56 +0200

>>>>> "PL" == Po Lu <[email-masked]> writes:

    PL> Milan Zamazal <[email-masked]> writes:
    >> On my Onyx e-ink reader, running probably some version of Android
    >> 10, I cannot access the external directory (either /sdcard or
    >> /storage/emulated/0) due to “Permission denied”.  I understand
    >> the Android system may not be cooperating, but e.g. Termux
    >> running on the same device can access /storage/emulated/0, after
    >> running termux-setup-storage, happily.  Both Emacs and Termux
    >> have the same “Storage” permission as reported by the system.
    >> 
    >> The Emacs version is 2023-07-03 from SourceForge.

    PL> As described by the Emacs manual, you should allow Emacs ``all
    PL> files access''.  This option is usually found in a section
    PL> titled special app access in Settings.

    >> Sorry for not providing the automatically gathered information
    >> but due to the permission problem above and the fact that the
    >> Emacs directory seems to be completely invisible, even when the
    >> device is connected via USB (all the other apps are present in
    >> /Android/data, but Emacs is not there and I couldn’t find it also
    >> anywhere else), I don’t know how to share anything from the Emacs
    >> on the device with the outer world.

    PL> Emacs's home directory is its ``internal app storage''
    PL> directory.  Android is distributed with a file manager that
    PL> should be able to display this directory in its hamburger icon
    PL> menu.

The device is an e-ink reader with a highly customized environment.  It
doesn’t have the standard settings manager, nor the standard file
manager.  All I can say is that:

- Emacs has the same storage permission as the other applications that
  can access the storage without any problems (e.g. Termux or a
  third-party file manager).

- I had to enable the permission manually, Emacs didn’t ask for it
  itself (unlike e.g. the file manager does).  I also tried to reboot
  the device, the permission is still there but Emacs cannot access the
  storage.

- When I mount the device storage on my desktop computer via USB and run
  ‘find -name "*emacs*"’ on it, the only thing found is the *.apk I
  installed Emacs from.  Again, the directories of other applications
  are visible.

As no other application I use on the device (e.g. several applications I
installed from F-Droid) suffers from the storage access problems nor
requires anything unusual to access the storage, I believe it’s an Emacs
bug.  Please tell me if there is anything I can do to help identifying
the cause of the problem.