Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 684172 - app-portage/gemato-14.0: OSError: [Errno 39] Directory not empty (on very old system)
Summary: app-portage/gemato-14.0: OSError: [Errno 39] Directory not empty (on very old...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-23 11:13 UTC by Petr Bahula
Modified: 2019-04-27 13:49 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Bahula 2019-04-23 11:13:41 UTC
Hi,
we had very old system (sys-apps/portage-2.2.20.1, sys-devel/gcc-4.9.3, ...).

I have copied into this system from other PC instaled portage sys-apps/portage-2.3.62, updated gcc to sys-devel/gcc-7.3.0-r3, updated pythons and made "emerge -uDN @system @world".

After that "emerge --sync" is crashing. I rebuild portage tree "emerge -e @system @world" but problem persists.
"emerge --sync" does not work with "sync-rsync-verify-metamanifest = yes". It works only if "sync-rsync-verify-metamanifest = no".

 # emerge --sync
>>> Syncing repository 'gentoo' into '/usr/portage'...
 * Using keys from /usr/share/openpgp-keys/gentoo-release.asc
 * Refreshing keys from keyserver ...[Errno 39] Directory not empty: '/tmp/tmpn5j5q36h'
[Errno 39] Directory not empty: '/tmp/tmplhqejynm'
[Errno 39] Directory not empty: '/tmp/tmpj5m8fh6b'
[Errno 39] Directory not empty: '/tmp/tmpinwyhwg8'
[Errno 39] Directory not empty: '/tmp/tmpgkv_wf3h'
[Errno 39] Directory not empty: '/tmp/tmp8_j1n04t'
[Errno 39] Directory not empty: '/tmp/tmp6uctqlsq'
[Errno 39] Directory not empty: '/tmp/tmpkrgphvod'
[Errno 39] Directory not empty: '/tmp/tmphfrv1hum'
portage.util.futures.executor.fork._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/portage/util/futures/executor/fork.py", line 68, in _guarded_fn_call
    result = fn(*args, **kwargs)
  File "/usr/lib64/python3.6/site-packages/portage/sync/syncbase.py", line 266, in noisy_refresh_keys
    openpgp_env.refresh_keys()
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 329, in refresh_keys
    if allow_wkd and self.refresh_keys_wkd():
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 315, in refresh_keys_wkd
    return False
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 216, in __exit__
    self.close()
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 231, in close
    shutil.rmtree(self._home, onerror=self._rmtree_error_handler)
  File "/usr/lib64/python3.6/shutil.py", line 484, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 227, in _rmtree_error_handler
    raise exc_info[1]
  File "/usr/lib64/python3.6/shutil.py", line 482, in rmtree
    os.rmdir(path)
OSError: [Errno 39] Directory not empty: '/tmp/tmphfrv1hum'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/portage/sync/modules/rsync/rsync.py", line 156, in update
    self._refresh_keys(openpgp_env)
  File "/usr/lib64/python3.6/site-packages/portage/sync/syncbase.py", line 281, in _refresh_keys
    loop.run_until_complete(decorated_func())
  File "/usr/lib64/python3.6/site-packages/portage/util/_eventloop/EventLoop.py", line 833, in run_until_complete
    return future.result()
OSError: [Errno 39] Directory not empty: '/tmp/tmphfrv1hum'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/portage/util/_async/AsyncFunction.py", line 39, in _run
    result = self.target(*(self.args or []), **(self.kwargs or {}))
  File "/usr/lib64/python3.6/site-packages/portage/sync/controller.py", line 168, in sync
    taskmaster.run_tasks(tasks, func, status, options=task_opts)
  File "/usr/lib64/python3.6/site-packages/portage/sync/controller.py", line 67, in run_tasks
    result = getattr(inst, func)(**kwargs)
  File "/usr/lib64/python3.6/site-packages/portage/sync/syncbase.py", line 304, in sync
    return self.update()
  File "/usr/lib64/python3.6/site-packages/portage/sync/modules/rsync/rsync.py", line 422, in update
    openpgp_env.close()
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 231, in close
    shutil.rmtree(self._home, onerror=self._rmtree_error_handler)
  File "/usr/lib64/python3.6/shutil.py", line 484, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 227, in _rmtree_error_handler
    raise exc_info[1]
  File "/usr/lib64/python3.6/shutil.py", line 482, in rmtree
    os.rmdir(path)
OSError: [Errno 39] Directory not empty: '/tmp/tmp5stya8vj'

Action: sync for repo: gentoo, returned code = 1


I tried to use directly gemato:

 # /usr/lib/python-exec/python3.6/gemato verify -K /usr/share/openpgp-keys/gentoo-release.asc /usr/portage
INFO:root:Refreshing keys...
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 541, in main
    vals.cmd.parse_args(vals, argp)
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 190, in parse_args
    super(VerifyCommand, self).parse_args(args, argp)
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 160, in parse_args
    super(BaseManifestLoaderMixin, self).parse_args(args, argp)
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 141, in parse_args
    keyserver=args.keyserver)
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 329, in refresh_keys
    if allow_wkd and self.refresh_keys_wkd():
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 315, in refresh_keys_wkd
    return False
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 216, in __exit__
    self.close()
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 231, in close
    shutil.rmtree(self._home, onerror=self._rmtree_error_handler)
  File "/usr/lib64/python3.6/shutil.py", line 484, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 227, in _rmtree_error_handler
    raise exc_info[1]
  File "/usr/lib64/python3.6/shutil.py", line 482, in rmtree
    os.rmdir(path)
OSError: [Errno 39] Directory not empty: '/tmp/tmpb2c5h6up'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.6/gemato", line 11, in <module>
    load_entry_point('gemato==14.0', 'console_scripts', 'gemato')()
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 556, in setuptools_main
    sys.exit(main(argv))
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 544, in main
    vals.cmd.cleanup()
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 110, in cleanup
    self.openpgp_env.close()
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 231, in close
    shutil.rmtree(self._home, onerror=self._rmtree_error_handler)
  File "/usr/lib64/python3.6/shutil.py", line 484, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 227, in _rmtree_error_handler
    raise exc_info[1]
  File "/usr/lib64/python3.6/shutil.py", line 482, in rmtree
    os.rmdir(path)
OSError: [Errno 39] Directory not empty: '/tmp/tmpshaa5gfw'


 # /usr/lib/python-exec/python2.7/gemato verify -K /usr/share/openpgp-keys/gentoo-release.asc /usr/portage
INFO:root:Refreshing keys...
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/gemato", line 11, in <module>
    load_entry_point('gemato==14.0', 'console_scripts', 'gemato')()
  File "/usr/lib64/python2.7/site-packages/gemato/cli.py", line 556, in setuptools_main
    sys.exit(main(argv))
  File "/usr/lib64/python2.7/site-packages/gemato/cli.py", line 544, in main
    vals.cmd.cleanup()
  File "/usr/lib64/python2.7/site-packages/gemato/cli.py", line 110, in cleanup
    self.openpgp_env.close()
  File "/usr/lib64/python2.7/site-packages/gemato/openpgp.py", line 231, in close
    shutil.rmtree(self._home, onerror=self._rmtree_error_handler)
  File "/usr/lib64/python2.7/shutil.py", line 270, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/lib64/python2.7/site-packages/gemato/openpgp.py", line 227, in _rmtree_error_handler
    raise exc_info[1]
OSError: [Errno 39] Directory not empty: '/tmp/tmp93skkv'





Appended emerge --info:
 # emerge --info
Portage 2.3.62 (python 3.6.5-final-0, default/linux/amd64/17.0, gcc-8.2.0, glibc-2.28-r6, 4.19.27-gentoo-r1 x86_64)
=================================================================
System uname: Linux-4.19.27-gentoo-r1-x86_64-QEMU_Virtual_CPU_version_2.5+-with-gentoo-2.6
KiB Mem:     1020428 total,     37988 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 23 Apr 2019 07:45:01 +0000
Head commit of repository gentoo: 047ba0a6984a025a2c8bd3227536d6211ba01e64
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.31.1 p5) 2.31.1
app-shells/bash:          4.4_p23-r1::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.3-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.31.1-r4::gentoo
sys-devel/gcc:            8.2.0-r6::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.14-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.28-r6::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: no
    sync-rsync-extra-opts: 

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/portage_data/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.jaist.ac.jp/pub/Linux/Gentoo/ http://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://ftp.halifax.rwth-aachen.de/gentoo/ http://gentoo.c3sl.ufpr.br/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/"
LANG="cs_CZ.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 berkdb bzip2 cli crypt cxx dri fortran gdbm iconv libtirpc mmx multilib ncurses nls nptl openmp pam pcre readline seccomp sse sse2 ssl tcpd unicode xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Zac Medico gentoo-dev 2019-04-23 19:02:45 UTC
It looks like there's a race in the OpenPGPEnvironment.close() method, where a gpg (or related) process creates a file in GNUPGHOME while it's being removed.

What version of app-crypt/gnupg do you have?
Comment 2 Petr Bahula 2019-04-24 07:57:21 UTC
(In reply to Zac Medico from comment #1)
> It looks like there's a race in the OpenPGPEnvironment.close() method, where
> a gpg (or related) process creates a file in GNUPGHOME while it's being
> removed.
> 
> What version of app-crypt/gnupg do you have?

app-crypt/gnupg-2.2.10

The system was successfully actualized Apr 14, 2019 by emerge -uDN @system @world" with using actual portage tree. All old packages was uninstalled.
The system was successfully rebuild-ed Apr 17, 2019 by "emerge -e @system @world" with using actual portage tree.


The race is aftereffect. The base of problem is bad environment for gemato or gnupg (from my view). I am ready for any tests or experiment.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-04-24 08:10:10 UTC
I've just pushed https://github.com/mgorny/gemato/commit/305cc46f2d0f89492c8dd3cceea08f4f57c00c4f to workaround this.  If you can still reproduce this, I'd appreciate testing.  It should get to master in a few minutes, unless CI fails, and then you can just install -9999 to test it.
Comment 4 Petr Bahula 2019-04-24 08:45:27 UTC
(In reply to Michał Górny from comment #3)
> I've just pushed
> https://github.com/mgorny/gemato/commit/
> 305cc46f2d0f89492c8dd3cceea08f4f57c00c4f to workaround this.  If you can
> still reproduce this, I'd appreciate testing.  It should get to master in a
> few minutes, unless CI fails, and then you can just install -9999 to test it.

 # /usr/lib/python-exec/python3.6/gemato verify -K /usr/share/openpgp-keys/gentoo-release.asc /usr/portage
INFO:root:Refreshing keys...
INFO:root:Keys refreshed.
INFO:root:Manifest timestamp: 2019-04-24 00:38:56 UTC
INFO:root:Valid OpenPGP signature found:
INFO:root:- primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
INFO:root:- subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
INFO:root:- timestamp: 2019-04-24 00:38:56 UTC
INFO:root:Verifying /usr/portage...
INFO:root:/usr/portage verified in 104.52 seconds


But (the root system is on NFS disk):

 # emerge --sync
>>> Syncing repository 'gentoo' into '/usr/portage'...
 * Using keys from /usr/share/openpgp-keys/gentoo-release.asc
 * Refreshing keys from keyserver ...[Errno 16] Device or resource busy: '.nfs0000000000579c1b000001f6'
[Errno 16] Device or resource busy: '.nfs0000000000579c35000001fb'
[Errno 16] Device or resource busy: '.nfs0000000000579c4b00000200'
[Errno 16] Device or resource busy: '.nfs0000000000579c6100000205'
                                                                                                            [ ok ]
>>> Starting rsync with rsync://89.238.64.78/gentoo-portage...

receiving incremental file list
timestamp.chk

.......

sent 31.22K bytes  received 6.20M bytes  377.38K bytes/sec
total size is 220.47M  speedup is 35.41
 * Manifest timestamp: 2019-04-24 07:38:53 UTC
 * Valid OpenPGP signature found:
 * - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
 * - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
 * - timestamp: 2019-04-24 07:38:53 UTC
 * Verifying /usr/portage/.tmp-unverified-download-quarantine ...                                                                                [ ok ]
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/portage/util/_async/AsyncFunction.py", line 39, in _run
    result = self.target(*(self.args or []), **(self.kwargs or {}))
  File "/usr/lib64/python3.6/site-packages/portage/sync/controller.py", line 168, in sync
    taskmaster.run_tasks(tasks, func, status, options=task_opts)
  File "/usr/lib64/python3.6/site-packages/portage/sync/controller.py", line 67, in run_tasks
    result = getattr(inst, func)(**kwargs)
  File "/usr/lib64/python3.6/site-packages/portage/sync/syncbase.py", line 304, in sync
    return self.update()
  File "/usr/lib64/python3.6/site-packages/portage/sync/modules/rsync/rsync.py", line 422, in update
    openpgp_env.close()
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 236, in close
    shutil.rmtree(self._home, onerror=self._rmtree_error_handler)
  File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 230, in _rmtree_error_handler
    raise exc_info[1]
  File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: '.nfs0000000000579c060000020e'

Action: sync for repo: gentoo, returned code = 1
Comment 5 Petr Bahula 2019-04-24 15:33:25 UTC
I made more tests with image of the system on dedicated PC with normal HDD and the "emerge --sync" and gemato work normal.
But with NFS disk the "emerge --sync" crash and the gemato (with the patch) crash frequently too:

 # /usr/lib/python-exec/python3.6/gemato verify -K /usr/share/openpgp-keys/gentoo-release.asc /usr/portage
INFO:root:Refreshing keys...
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 541, in main
    vals.cmd.parse_args(vals, argp)
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 190, in parse_args
    super(VerifyCommand, self).parse_args(args, argp)
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 160, in parse_args
    super(BaseManifestLoaderMixin, self).parse_args(args, argp)
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 141, in parse_args
    keyserver=args.keyserver)
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 334, in refresh_keys
    if allow_wkd and self.refresh_keys_wkd():
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 320, in refresh_keys_wkd
    return False
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 216, in __exit__
    self.close()
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 236, in close
    shutil.rmtree(self._home, onerror=self._rmtree_error_handler)
  File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 230, in _rmtree_error_handler
    raise exc_info[1]
  File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: '.nfs000000000058e1700000277e'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.6/gemato", line 11, in <module>
    load_entry_point('gemato==14.0', 'console_scripts', 'gemato')()
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 556, in setuptools_main
    sys.exit(main(argv))
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 544, in main
    vals.cmd.cleanup()
  File "/usr/lib64/python3.6/site-packages/gemato/cli.py", line 110, in cleanup
    self.openpgp_env.close()
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 236, in close
    shutil.rmtree(self._home, onerror=self._rmtree_error_handler)
  File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib64/python3.6/site-packages/gemato/openpgp.py", line 230, in _rmtree_error_handler
    raise exc_info[1]
  File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: '.nfs000000000058e15b00002782'


The patch work but correct only part of the problem.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-04-24 15:59:24 UTC
NFS is a whole different story.  I'm not sure if it's supported at all or worth supporting.  I recall there was some kernel bug that caused similar issues, so maybe that's it?  You could also try adding EBUSY to the list in the patch, and seeing if that helps (or just hangs gemato indefinitely).
Comment 7 Petr Bahula 2019-04-24 16:24:37 UTC
(In reply to Michał Górny from comment #6)
> NFS is a whole different story.  I'm not sure if it's supported at all or
> worth supporting.  I recall there was some kernel bug that caused similar
> issues, so maybe that's it?  You could also try adding EBUSY to the list in
> the patch, and seeing if that helps (or just hangs gemato indefinitely).

First tests with added EBUSY look OK. I will continue testing tomorrow.
Comment 8 Petr Bahula 2019-04-25 12:39:00 UTC
Hi,
with added errno.EBUSY to the list in the patch everything works without any mistakes on NFS too.
Please add the errno.EBUSY to the final patch.
It is possible to mark the bug as RESOLVED.
Thank you for help.
Comment 9 Larry the Git Cow gentoo-dev 2019-04-27 13:49:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c654d91e8ffa244e28037a1b2d7d94ad5f203b2b

commit c654d91e8ffa244e28037a1b2d7d94ad5f203b2b
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-04-27 13:42:53 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-04-27 13:48:44 +0000

    app-portage/gemato: Bump to 14.1
    
    Closes: https://bugs.gentoo.org/684172
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 app-portage/gemato/Manifest           |  1 +
 app-portage/gemato/gemato-14.1.ebuild | 43 +++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)