Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-1988

Aborts if directory scan finds a directory which cannot be read

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.5.1
    • 2.4, 2.4.4, 2.5
    • None
    • Debian unstable

      Forwarding a bug report from Debian:

      Picard aborts when it comes across a directory that cannot be read:

      $ picard /storage/music/
      I: 15:52:59,827 /usr/lib/picard/picard/config._backup_settings:274: Backing up config file to /home/ijc/.config/MusicBrainz/Picard-2.4.1.ini
      Traceback (most recent call last):
        File "/usr/lib/picard/picard/tagger.py", line 391, in _run_init
          self.add_directory(decode_filename(file))
        File "/usr/lib/picard/picard/tagger.py", line 574, in add_directory
          files = self._scan_dir([path],
        File "/usr/lib/picard/picard/tagger.py", line 542, in _scan_dir
          for entry in os.scandir(current_folder):
      PermissionError: [Errno 13] Permission denied: '/storage/music/lost+found'
      Aborted
      $ ls -ld /storage/music/lost+found/
      drwx------ 2 root root 16384 Jun 25  2011 /storage/music/lost+found//
      

      This can easily be reproduced with the extreme case of a directory that cannot be read by anyone:

      $ mkdir -p /tmp/picard/test
      $ chmod a-rwx /tmp/picard/test
      $ picard /tmp/picard
      Traceback (most recent call last):
        File "/usr/lib/picard/picard/tagger.py", line 391, in _run_init
          self.add_directory(decode_filename(file))
        File "/usr/lib/picard/picard/tagger.py", line 574, in add_directory
          files = self._scan_dir([path],
        File "/usr/lib/picard/picard/tagger.py", line 542, in _scan_dir
          for entry in os.scandir(current_folder):
      PermissionError: [Errno 13] Permission denied: '/tmp/picard/test'
      

          [PICARD-1988] Aborts if directory scan finds a directory which cannot be read

          GitHub Bot added a comment -

          See code changes in pull request #1666 submitted by phw.

          GitHub Bot added a comment - See code changes in pull request #1666 submitted by phw .

          Philipp Wolfer added a comment - - edited

          That's a regression introduced in 2.4, also still present in 2.5.

           

          Introduced in https://github.com/metabrainz/picard/commit/2c06a625da370f8e48dafe978bdf7fab28db3f18

          This replaced the os.walk call with a custom implementation, but os.walk by default does ignore errors from os.scandir. Our current implementation should probably, too.

          Philipp Wolfer added a comment - - edited That's a regression introduced in 2.4, also still present in 2.5.   Introduced in https://github.com/metabrainz/picard/commit/2c06a625da370f8e48dafe978bdf7fab28db3f18 This replaced the os.walk call with a custom implementation, but os.walk by default does ignore errors from os.scandir. Our current implementation should probably, too.

            outsidecontext Philipp Wolfer
            sebastinas Sebastian Ramacher
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Version Package
                2.5.1