Opened 6 weeks ago

Last modified 5 weeks ago

#71041 assigned defect

go: activation error due to unusual destroot layout when /opt/local is a symlink

Reported by: LiamMoy (Liam Moy) Owned by: ci42
Priority: Normal Milestone:
Component: ports Version: 2.10.2
Keywords: Cc: herbygillot (Herby Gillot)
Port: go

Description (last modified by ryandesign (Ryan Carsten Schmidt))

"go violates the layout of the ports-filesystems"

  • warning when staging, and error when activating
  • port go-1.23.2_0.darwin_23.x86_64
  • in MacPorts 2.10.2
  • when /opt/local is a symlink to another location (in this case /Volumes/usb1TBssd/opt/local)

# Console output as follows:

--->  Fetching archive for go
--->  Attempting to fetch go-1.23.2_0.darwin_23.x86_64.tbz2 from https://packages.macports.org/go
--->  Attempting to fetch go-1.23.2_0.darwin_23.x86_64.tbz2 from https://pek.cn.packages.macports.org/macports/packages/go
--->  Attempting to fetch go-1.23.2_0.darwin_23.x86_64.tbz2 from https://kmq.jp.packages.macports.org/go
--->  Fetching distfiles for go
--->  Attempting to fetch go1.23.2.src.tar.gz from https://storage.googleapis.com/golang/
--->  Attempting to fetch go1.23.2.darwin-amd64.tar.gz from https://storage.googleapis.com/golang/
--->  Verifying checksums for go
--->  Extracting go
--->  Configuring go
--->  Building go
--->  Staging go into destroot
Warning: violation by /.DS_Store
Warning: violation by /Volumes/.DS_Store
Warning: violation by /Volumes/usb1TBssd/.DS_Store
Warning: violation by /Volumes/usb1TBssd/opt/.DS_Store
Warning: violation by /Volumes/usb1TBssd/opt/local/.DS_Store
Warning: go violates the layout of the ports-filesystems!
Warning: Please fix or indicate this misbehavior (if it is intended), it will be an error in future releases!
--->  Installing go @1.23.2_0
--->  Cleaning go
[...]
--->  Dependencies to be installed: go
--->  Activating go @1.23.2_0
Error: Failed to activate go: Image error: /Volumes/usb1TBssd/.DS_Store already exists and does not belong to a registered port.  Unable to activate port go. Use 'port -f activate go' to force the activation.
    while executing
"throw registry::image-error $msg"
    ("foreach" body line 77)
    invoked from within
"foreach file $imagefiles {
                incr progress_step
                _progress update $progress_step $progress_total_steps
                se..."
    invoked from within
"registry::write {
            foreach file $imagefiles {
                incr progress_step
                _progress update $progress_step $progress_..."
Error: See /Volumes/usb1TBssd/opt/local/var/macports/logs/_Volumes_usb1TBssd_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_go/go/main.log for details.

Attachments (2)

Screenshot 2024-10-05 at 18.32.35.png (500.4 KB) - added by LiamMoy (Liam Moy) 6 weeks ago.
comparison-of-tbz2-directory-structure-where-opt-local-is-symlinked_go-vs-emacs-vs-maven
main.log (2.6 MB) - added by LiamMoy (Liam Moy) 6 weeks ago.

Change History (8)

comment:1 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)

Cc: herbygillot added
Description: modified (diff)
Owner: set to ci42
Status: newassigned
Summary: "Warning: go violates the layout of the ports-filesystems!"go: installs .DS_Store files when /opt/local is a symlink

Do you see this with other ports or only with go?

Probably no port should be installing .DS_Store files but this might be happening because of your /opt/local symlink (which is not a modification we test or recommend). According to this search there are 23 ports that install .DS_Store files but go isn't one of them.

Changed 6 weeks ago by LiamMoy (Liam Moy)

comparison-of-tbz2-directory-structure-where-opt-local-is-symlinked_go-vs-emacs-vs-maven

Changed 6 weeks ago by LiamMoy (Liam Moy)

Attachment: main.log added

comment:2 Changed 6 weeks ago by LiamMoy (Liam Moy)

Do you see this with other ports or only with go?

Out of 200 ports, only go had this issue.

Probably no port should be installing .DS_Store files but this might be happening because of your /opt/local symlink

The issue isn't it copying .DS_Store files per se, the issue is that when /opt/local is symlinked the idiosyncratic directory structure inside the go .tbz2 archive is making things haywire in that foreach in the activation:

Attached is a screenshot comparing the structure of the .tbz2 archives of the go port and two (arbitrary) other ports that don't have this idiosyncracy: emacs and maven.

When /opt/local is symlinked the go .tbz2 extracts with its internal subdirectory structure as path/to/symlinked (in this case go-1.23.2_0.darwin_23.x86_64/Volumes/usb1TBssd/opt/local) whereas all other ports extract to [port]/opt/local/ (i.e. path/to/symlink).

This is what the error messages refers to when it says "go violates the layout of the ports-filesystems".

comment:3 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)

Text terminal output is preferred over screenshots.

The go-1.23.2_0.darwin_23.x86_64.tbz2 on our server does not of course contain any references to your usb1TBssd volume so this situation must only come about if you build go from source on a system where /opt/local is a symlink.

As I said this is not a configuration that MacPorts maintainers test. Nobody designing MacPorts ever expected a user to replace the prefix with a symlink so I'm not surprised there are issues as a result.

Reading over the go port's destroot phase, I don't immediately see why this problem would happen. If you can figure out why this happens and what needs to be changed in the go port to fix it, please submit a pull request. I'm not sure if the maintainers of the go port will work on fixing it since it is a nonstandard configuration and they may not have the resources to set up a test environment that matches yours to be able to reproduce and fix it.

comment:4 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)

Summary: go: installs .DS_Store files when /opt/local is a symlinkgo: activation error due to unusual destroot layout when /opt/local is a symlink

In case it's relevant, your main.log file shows two attempts to install the go port. The first one ends with the error you originally reported while the second attempt ends with:

:error:activate Failed to activate go: error deleting "/Volumes/usb1TBssd/opt/local/var/macports/software/go/go-1.23.2_0.darwin_23.x86_64/Volumes/usb1TBssd/opt/local/lib/go": file already exists
:debug:activate Error code: POSIX EEXIST {file already exists}

comment:5 Changed 6 weeks ago by LiamMoy (Liam Moy)

I'm not sure if the maintainers of the go port will work on fixing it since it is a nonstandard configuration and they may not have the resources to set up a test environment that matches yours to be able to reproduce and fix it.

That's fine, I'm just reporting the warning that I observed in this context, which is "go violates the layout of the ports-filesystems".

If you can figure out why this happens and what needs to be changed in the go port to fix it, please submit a pull request.

Will do.

The ​go-1.23.2_0.darwin_23.x86_64.tbz2 on our server does not of course contain any references to your usb1TBssd volume so this situation must only come about if you build go from source on a system where /opt/local is a symlink

It's not built from source; the go .tbz2 is extracting to subdirectories with paths taken from the underlying target of /opt/local when /opt/local is a symlink, that's all that's happening.

In case it's relevant, your main.log file shows two attempts to install the go port.

I believe that's a result of a subsequent installation of a port with go as a dependency, hence:

[...]
--->  Dependencies to be installed: go

Anyway, thanks. I enjoy your software.

comment:6 in reply to:  5 Changed 5 weeks ago by ryandesign (Ryan Carsten Schmidt)

Replying to LiamMoy:

The ​go-1.23.2_0.darwin_23.x86_64.tbz2 on our server does not of course contain any references to your usb1TBssd volume so this situation must only come about if you build go from source on a system where /opt/local is a symlink

It's not built from source; the go .tbz2 is extracting to subdirectories with paths taken from the underlying target of /opt/local when /opt/local is a symlink, that's all that's happening.

I don't quite follow what you're saying, but are you certain that this .tbz2 file was not created on your system (as a result of building from source)? Try:

tar tjf /Volumes/usb1TBssd/opt/local/var/macports/software/go/go-1.23.2_0.darwin_23.x86_64.tbz2

Do you see any references to usb1TBssd? If so, this archive was created on your system.

Note: See TracTickets for help on using tickets.