Opened 7 months ago

Last modified 7 months ago

#68440 assigned defect

ijq @0.4.1, kiln @0.4.0: failed to extract: error renaming ...: trying to rename a volume or move a directory into itself

Reported by: ianthrive (Ian Timothy) Owned by: herbygillot (Herby Gillot)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: gpanders (Gregory Anders), woolsweater (Josh Caswell), sikmir (Nikolay Korotkiy)
Port: ijq, hut, kiln

Description

% doas port clean ijq
--->  Cleaning ijq

% doas port install ijq                                                                                                                          
[...snip...]
--->  Extracting ijq
Error: Failed to extract ijq: error renaming "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_ijq/ijq/work/ijq-v0.4.1" to "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_ijq/ijq/work/ijq-v0.4.1/ijq-v0.4.1": trying to rename a volume or move a directory into itself
[...snip...]

% cat /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_ijq/ijq/main.log
[...snip...]
:debug:extract Executing proc-post-org.macports.extract-extract-1
:error:extract Failed to extract ijq: error renaming "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_ijq/ijq/work/ijq-v0.4.1" to "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_ijq/ijq/work/ijq-v0.4.1/ijq-v0.4.1": trying to rename a volume or move a directory into itself
:debug:extract Error code: NONE
:debug:extract Backtrace: error renaming "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_ijq/ijq/work/ijq-v0.4.1" to "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_ijq/ijq/work/ijq-v0.4.1/ijq-v0.4.1": trying to rename a volume or move a directory into itself
[...snip...]
% uname -a
Darwin [...snip...] 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000 arm64

% sw_vers -ProductVersion
14.0

% port version
Version: 2.8.1

% pkgutil --pkg-info=com.apple.pkg.{CLTools_Executables,CLTools_Base,DeveloperToolsCLI,DeveloperToolsCLILeo} 2>/dev/null | sed -n 's/^version: //p'
15.0.0.0.1.1694021235

% xcodebuild -version
Xcode 15.0
Build version 15A240d

Attachments (1)

main.log (18.1 KB) - added by ianthrive (Ian Timothy) 7 months ago.

Download all attachments as: .zip

Change History (2)

Changed 7 months ago by ianthrive (Ian Timothy)

Attachment: main.log added

comment:1 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: woolsweater sikmir added
Port: hut kiln added
Summary: ijq @0.4.1: failed to extract: error renaming ...: trying to rename a volume or move a directory into itselfijq @0.4.1, kiln @0.4.0: failed to extract: error renaming ...: trying to rename a volume or move a directory into itself

This may be fallout from a change which was first included in MacPorts 2.8.1 on January 30, 2023. We most recently had successful builds of ijq on December 25, 2022.

Here's what seems to be happening. The ijq port includes the golang portgroup, which changes the default worksrcdir:

default worksrcdir      {gopath/src/${go.package}}

The port calls the portgroup's go.setup procedure which, because this project is hosted at sourcehut, then includes the sourcehut portgroup and calls its sourcehut.setup procedure.

sourcehut.setup changes the default worksrcdir again:

    default worksrcdir      {${sourcehut.project}-${git.branch}}

The golang portgroup's post-extract block is documented to do this:

# Setup build sources in GOPATH style:
#   workpath/
#       gopath/src/example.com/
#           author1/project1/
#           author2/project2/

However it does so by creating ${worksrcpath} (except for the last component) and trying to move what was extracted to ${worksrcpath}, apparently not anticipating that anyone would override it in a Portfile or in another portgroup. If the golang portgroup is so insistent about its worksrcdir, it should set it, not its default. However, it also seems like a misuse of worksrcdir. worksrcdir is supposed to refer to the name of the top-level extracted directory. It certainly should not contain slashes. If any of the phases (extract, patch, configure, build, destroot) need to happen in some other directory, that's what the variables extract.dir, patch.dir, etc. are for.

I would look carefully at all of the ports that use the golang and sourcehut portgroups together to see if they have the same problem. That appears to be only three ports: ijq, hut, and kiln. I see that kiln fails with the same message as ijq while hut succeeds because it contains a workaround for this problem that was added when that port was created:

# Tarball contents name conflicts with the default work dir name
worksrcdir          ${name}-${version}-${epoch}

It would be good to fix the problem in one of the portgroups so that the strange workaround can be removed from the hut Portfile. There was no discussion of this strange workaround in the PR that added the hut port.

Note: See TracTickets for help on using tickets.