Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 787542 - sys-apps/portage: die hooks called when ${T} does not exist
Summary: sys-apps/portage: die hooks called when ${T} does not exist
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-01 21:25 UTC by Zac Medico
Modified: 2021-05-02 00:50 UTC (History)
0 users

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 Zac Medico gentoo-dev 2021-05-01 21:25:57 UTC
> >>> Running pre-merge checks for acct-group/adm-0
> >>> Running pre-merge checks for acct-group/wheel-0
> ^CException in callback AsynchronousTask._exit_listener_cb(<bound method...7fd3904f19d0>>)
> handle: <Handle AsynchronousTask._exit_listener_cb(<bound method...7fd3904f19d0>>)>
> Traceback (most recent call last):
>   File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
>     self._context.run(self._callback, *self._args)
>   File "/usr/lib/python3.8/site-packages/_emerge/AsynchronousTask.py", line 201, in _exit_listener_cb
>     listener(self)
>   File "/usr/lib/python3.8/site-packages/_emerge/EbuildPhase.py", line 224, in _ebuild_exit
>     self._ebuild_exit_unlocked(ebuild_process)
>   File "/usr/lib/python3.8/site-packages/_emerge/EbuildPhase.py", line 268, in _ebuild_exit_unlocked
>     self._die_hooks()
>   File "/usr/lib/python3.8/site-packages/_emerge/EbuildPhase.py", line 376, in _die_hooks
>     self._start_task(die_hooks, self._die_hooks_exit)
>   File "/usr/lib/python3.8/site-packages/_emerge/CompositeTask.py", line 113, in _start_task
>     task.start()
>   File "/usr/lib/python3.8/site-packages/_emerge/AsynchronousTask.py", line 30, in start
>     self._start()
>   File "/usr/lib/python3.8/site-packages/_emerge/MiscFunctionsProcess.py", line 29, in _start
>     AbstractEbuildProcess._start(self)
>   File "/usr/lib/python3.8/site-packages/_emerge/AbstractEbuildProcess.py", line 169, in _start 
>     self._start_post_builddir_lock(start_ipc_daemon=start_ipc_daemon)
>   File "/usr/lib/python3.8/site-packages/_emerge/AbstractEbuildProcess.py", line 200, in _start_post_builddir_lock
>     SpawnProcess._start(self)
>   File "/usr/lib/python3.8/site-packages/_emerge/SpawnProcess.py", line 132, in _start
>     build_logger.start()
>   File "/usr/lib/python3.8/site-packages/_emerge/AsynchronousTask.py", line 30, in start
>     self._start()
>   File "/usr/lib/python3.8/site-packages/portage/util/_async/BuildLogger.py", line 77, in _start
>     pipe_logger.start()
>   File "/usr/lib/python3.8/site-packages/_emerge/AsynchronousTask.py", line 30, in start
>     self._start()
>   File "/usr/lib/python3.8/site-packages/portage/util/_async/PipeLogger.py", line 36, in _start 
>     self._log_file = open(_unicode_encode(log_file_path,
> FileNotFoundError: [Errno 2] No such file or directory: b'/var/tmp/portage/acct-group/wheel-0/temp/build.log'
> Terminated
Comment 1 Larry the Git Cow gentoo-dev 2021-05-02 00:00:04 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=bfe550f69ac4e0126412bc83f7e6f6f0d1c6dc1f

commit bfe550f69ac4e0126412bc83f7e6f6f0d1c6dc1f
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2021-05-01 23:38:50 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-05-01 23:49:07 +0000

    PipeLogger: handle FileNotFoundError when cancelled during _start
    
    Bug: https://bugs.gentoo.org/787542
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/util/_async/PipeLogger.py | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)
Comment 2 Zac Medico gentoo-dev 2021-05-02 00:22:03 UTC
(In reply to Zac Medico from comment #0)
> > >>> Running pre-merge checks for acct-group/adm-0
> > >>> Running pre-merge checks for acct-group/wheel-0
> > ^CException in callback AsynchronousTask._exit_listener_cb(<bound method...7fd3904f19d0>>)
> > handle: <Handle AsynchronousTask._exit_listener_cb(<bound method...7fd3904f19d0>>)>
> > Traceback (most recent call last):
> >   File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
> >     self._context.run(self._callback, *self._args)
> >   File "/usr/lib/python3.8/site-packages/_emerge/AsynchronousTask.py", line 201, in _exit_listener_cb
> >     listener(self)
> >   File "/usr/lib/python3.8/site-packages/_emerge/EbuildPhase.py", line 224, in _ebuild_exit
> >     self._ebuild_exit_unlocked(ebuild_process)
> >   File "/usr/lib/python3.8/site-packages/_emerge/EbuildPhase.py", line 268, in _ebuild_exit_unlocked
> >     self._die_hooks()

It looks like it called die hooks when ${T} did not exist, which is guaranteed to fail.
Comment 3 Zac Medico gentoo-dev 2021-05-02 00:35:55 UTC
We can skip die hooks if ${T} is missing, since it implies that there are no hooks to execute.
Comment 4 Zac Medico gentoo-dev 2021-05-02 00:45:13 UTC
Since die hooks are called from the _ebuild_exit_unlocked method, it's not even safe to use ${T} since the build directory is not locked.
Comment 5 Zac Medico gentoo-dev 2021-05-02 00:50:04 UTC
The die hooks need to be triggered from the EbuildPhase _ebuild_exit method, before the build directory is unlocked:

> 	def _ebuild_exit(self, ebuild_process):
> 		self._assert_current(ebuild_process)
> 		if self._ebuild_lock is None:
> 			self._ebuild_exit_unlocked(ebuild_process)
> 		else:
> 			self._start_task(
> 				AsyncTaskFuture(future=self._ebuild_lock.async_unlock()),
> 				functools.partial(self._ebuild_exit_unlocked, ebuild_process))