[Pkg-bazaar-maint] Bug#944379: brz: ERROR: [Errno 2] No such file or directory: '.config/breezy'

Jochen Sprickerhof jspricke at debian.org
Fri Nov 8 21:59:13 GMT 2019


Package: python3-breezy
Version: 3.0.1-6
Severity: normal
Tags: patch

Hi,

breezy doesn't always create it's config dir resulting in an exception.
The current behaviour breaks ros-wstool since the switch from bzr to brz:

https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/ros-wstool.html

Steps to reproduce:

$ cd $(mktemp -d)
$ HOME=$(pwd) brz init
Created a standalone tree (format: 2a)
$ touch foo
$ HOME=$(pwd) brz status
brz: ERROR: [Errno 2] No such file or directory: '/tmp/tmp.7OnfYj98A5/.config/breezy'


Excrept from the .bzr.log:

0.039  encoding stdout as sys.stdout encoding 'UTF-8'
0.039  encoding stdout as sys.stdout encoding 'UTF-8'
0.039  encoding stdout as sys.stdout encoding 'UTF-8'
0.049  breezy version: 3.0.1
0.049  brz arguments: ['status']
0.154  encoding stdout as sys.stdout encoding 'UTF-8'
0.170  opening working tree '/tmp/tmp.7OnfYj98A5'
0.172  check paths: None
0.173  creating config directory: '/tmp/tmp.7OnfYj98A5/.config/breezy'
0.173  Transferred: 0kB (0.0kB/s r:0kB w:0kB)
0.175  Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/breezy/ignores.py", line 93, in get_user_ignores
    f = open(path, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp.7OnfYj98A5/.config/breezy/ignore'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1016, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1202, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 759, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 784, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/breezy/cleanup.py", line 137, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/breezy/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1219, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/breezy/builtins.py", line 422, in run
    classify=not no_classify)
  File "/usr/lib/python3/dist-packages/breezy/status.py", line 168, in show_tree_status
    show_ids=show_ids, classify=classify)
  File "/usr/lib/python3/dist-packages/breezy/status.py", line 80, in report_changes
    delta.unversioned if not new.is_ignored(unversioned[0])]
  File "/usr/lib/python3/dist-packages/breezy/status.py", line 80, in <listcomp>
    delta.unversioned if not new.is_ignored(unversioned[0])]
  File "/usr/lib/python3/dist-packages/breezy/bzr/workingtree.py", line 604, in is_ignored
    self.get_ignore_list())
  File "/usr/lib/python3/dist-packages/breezy/bzr/workingtree.py", line 576, in get_ignore_list
    ignore_globs.update(ignores.get_user_ignores())
  File "/usr/lib/python3/dist-packages/breezy/ignores.py", line 103, in get_user_ignores
    _set_user_ignores(USER_DEFAULTS)
  File "/usr/lib/python3/dist-packages/breezy/ignores.py", line 125, in _set_user_ignores
    config.ensure_config_dir_exists()
  File "/usr/lib/python3/dist-packages/breezy/config.py", line 1449, in ensure_config_dir_exists
    os.mkdir(path)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp.7OnfYj98A5/.config/breezy'

0.175  return code 3


The easiest fix is to use os.makedirs instead of os.mkdir. See attached
patch.

Cheers Jochen

P.S.: brz in experimental is not installable, because this is not
fulfillable:

python3-breezy (<= 3.1.0~bzr7295-1.1~)
python3-breezy (>= 3.1.0~bzr7295-1)

$ dpkg --compare-versions "3.1.0~bzr7372-1" lt "3.1.0~bzr7295-1.1" && echo true

I would propose to use 3.1.0-bzr7372 as the upstream version in future,
as the tilde is special.

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.3.8 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-breezy depends on:
ii  libc6               2.29-3
ii  python3             3.7.5-1
ii  python3-configobj   5.0.6-3
ii  python3-dulwich     0.19.13-1
ii  python3-fastimport  0.9.8-2
ii  python3-six         1.12.0-2

Versions of packages python3-breezy recommends:
ii  ca-certificates              20190110
ii  openssh-client [ssh-client]  1:8.1p1-1
pn  python3-github               <none>
pn  python3-gitlab               <none>
pn  python3-gpg                  <none>
pn  python3-launchpadlib         <none>
ii  python3-paramiko             2.6.0-1

Versions of packages python3-breezy suggests:
pn  python3-breezy-dbg    <none>
pn  python3-breezy.tests  <none>
pn  python3-kerberos      <none>
ii  python3-paramiko      2.6.0-1
ii  xdg-utils             1.1.3-1

-- no debconf information
-------------- next part --------------
--- breezy-3.0.1.orig/breezy/config.py
+++ breezy-3.0.1/breezy/config.py
@@ -1446,7 +1446,7 @@ def ensure_config_dir_exists(path=None):
                     'creating config parent directory: %r', parent_dir)
                 os.mkdir(parent_dir)
         trace.mutter('creating config directory: %r', path)
-        os.mkdir(path)
+        os.makedirs(path)
         osutils.copy_ownership_from_path(path)
 
 


More information about the Pkg-bazaar-maint mailing list