[GH-ISSUE #584] Issue: act sets HOME env var but doesn't update /etc/passwd #389

Closed
opened 2026-03-01 21:42:56 +03:00 by kerem · 0 comments
Owner

Originally created by @grossws on GitHub (Mar 27, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/584

It seems Java use homedir from nsswitch, so this behavior breaks java build tools like Apache Maven & Gradle which use user.home system property to resolve configuration. E.g. actions/setup-java@v1 writes settings.xml to /github/home/.m2/settings.xml (nodejs resolves using $HOME) but maven later tries to lookup it from /root/.m2/settings.xml (jre resolves using nss).

Act version

act version 0.2.20

Expected behaviour

act to set same home dir in both $HOME and /etc/passwd.

Actual behaviour

$HOME is set to /github/home but /etc/passwd contains root:x:0:0:root:/root:/bin/bash.

Workflow and/or repository

workflow
name: t
on:
  push:
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-java@v1
        with:
          java-version: 11
      - run: |
          echo 'public class Test {
            public static void main(String[] args) {
              System.out.println("user.home: " + System.getProperty("user.home"));
            }
          }' >Test.java
          javac Test.java
          java Test
          id
          getent passwd $(id -u)
          echo "\$HOME=$HOME"

Steps to reproduce

  1. Run act with workflow above

act output

Log
55% at [03:35:45] ➜ act -j test  
[t/test] 🚀  Start image=catthehacker/ubuntu:act-latest
[t/test]   🐳  docker run image=catthehacker/ubuntu:act-latest entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[t/test] ⭐  Run actions/setup-java@v1
[t/test]   ☁  git clone 'https://github.com/actions/setup-java' # ref=v1
[t/test]   🐳  docker cp src=/home/gross/.cache/act/actions-setup-java@v1 dst=/actions/
[t/test]   💬  ::debug::isExplicit: 
[t/test]   💬  ::debug::explicit? false
[t/test]   💬  ::debug::evaluating 0 versions
[t/test]   💬  ::debug::match not found
[t/test]   💬  ::debug::Downloading JDK from Azul
[t/test]   💬  ::debug::Searching for files with extension: -linux_x64.tar.gz
[t/test]   💬  ::debug::Downloading https://static.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz
[t/test]   💬  ::debug::Downloading /tmp/83e9fe7b-9d34-482b-8dbb-66c619b5ba26
[t/test]   💬  ::debug::download complete
| [command]/bin/tar --version
| tar (GNU tar) 1.29
| Copyright (C) 2015 Free Software Foundation, Inc.
| License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
| This is free software: you are free to change and redistribute it.
| There is NO WARRANTY, to the extent permitted by law.
| 
| Written by John Gilmore and Jay Fenlason.
| [command]/bin/tar xz --warning=no-unknown-keyword -C /tmp/temp_756265902 -f /tmp/83e9fe7b-9d34-482b-8dbb-66c619b5ba26
[t/test]   💬  ::debug::jdk extracted to /tmp/temp_756265902/zulu11.45.27-ca-jdk11.0.10-linux_x64
[t/test]   💬  ::debug::Caching tool jdk 11.0.10 x64
[t/test]   💬  ::debug::source dir: /tmp/temp_756265902/zulu11.45.27-ca-jdk11.0.10-linux_x64
[t/test]   💬  ::debug::destination /opt/hostedtoolcache/jdk/11.0.10/x64
[t/test]   💬  ::debug::finished caching tool
[t/test]   ⚙  ::add-path:: /opt/hostedtoolcache/jdk/11.0.10/x64/bin
[t/test]   ⚙  ::set-output:: path=/opt/hostedtoolcache/jdk/11.0.10/x64
[t/test]   ⚙  ::set-output:: version=11.0.10
[t/test]   ❓  ##[add-matcher]/actions/actions-setup-java@v1/.github/java.json
| creating settings.xml with server-id: github; environment variables: username=$GITHUB_ACTOR, password=$GITHUB_TOKEN, and gpg-passphrase=null
[t/test]   💬  ::debug::created directory /github/home/.m2
| writing /github/home/.m2/settings.xml
[t/test]   ✅  Success - actions/setup-java@v1
[t/test] ⭐  Run echo 'public class Test {
  public static void main(String[] args) {
    System.out.println("user.home: " + System.getProperty("user.home"));
  }
}' >Test.java
javac Test.java
java Test
id
getent passwd $(id -u)
echo "\$HOME=$HOME"
| user.home: /root
| uid=0(root) gid=0(root) groups=0(root)
| root:x:0:0:root:/root:/bin/bash
| $HOME=/github/home
[t/test]   ✅  Success - echo 'public class Test {
  public static void main(String[] args) {
    System.out.println("user.home: " + System.getProperty("user.home"));
  }
}' >Test.java
javac Test.java
java Test
id
getent passwd $(id -u)
echo "\$HOME=$HOME"
Originally created by @grossws on GitHub (Mar 27, 2021). Original GitHub issue: https://github.com/nektos/act/issues/584 It seems Java use homedir from nsswitch, so this behavior breaks java build tools like Apache Maven & Gradle which use `user.home` system property to resolve configuration. E.g. `actions/setup-java@v1` writes `settings.xml` to `/github/home/.m2/settings.xml` (nodejs resolves using `$HOME`) but maven later tries to lookup it from `/root/.m2/settings.xml` (jre resolves using nss). ## Act version ```none act version 0.2.20 ``` ## Expected behaviour `act` to set same home dir in both `$HOME` and `/etc/passwd`. ## Actual behaviour `$HOME` is set to `/github/home` but `/etc/passwd` contains `root:x:0:0:root:/root:/bin/bash`. ## Workflow and/or repository <details> <summary>workflow</summary> ```yaml name: t on: push: jobs: test: runs-on: ubuntu-latest steps: - uses: actions/setup-java@v1 with: java-version: 11 - run: | echo 'public class Test { public static void main(String[] args) { System.out.println("user.home: " + System.getProperty("user.home")); } }' >Test.java javac Test.java java Test id getent passwd $(id -u) echo "\$HOME=$HOME" ``` </details> ## Steps to reproduce 1. Run `act` with workflow above ## `act` output <details> <summary>Log</summary> ```none 55% at [03:35:45] ➜ act -j test [t/test] 🚀 Start image=catthehacker/ubuntu:act-latest [t/test] 🐳 docker run image=catthehacker/ubuntu:act-latest entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [t/test] ⭐ Run actions/setup-java@v1 [t/test] ☁ git clone 'https://github.com/actions/setup-java' # ref=v1 [t/test] 🐳 docker cp src=/home/gross/.cache/act/actions-setup-java@v1 dst=/actions/ [t/test] 💬 ::debug::isExplicit: [t/test] 💬 ::debug::explicit? false [t/test] 💬 ::debug::evaluating 0 versions [t/test] 💬 ::debug::match not found [t/test] 💬 ::debug::Downloading JDK from Azul [t/test] 💬 ::debug::Searching for files with extension: -linux_x64.tar.gz [t/test] 💬 ::debug::Downloading https://static.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz [t/test] 💬 ::debug::Downloading /tmp/83e9fe7b-9d34-482b-8dbb-66c619b5ba26 [t/test] 💬 ::debug::download complete | [command]/bin/tar --version | tar (GNU tar) 1.29 | Copyright (C) 2015 Free Software Foundation, Inc. | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. | This is free software: you are free to change and redistribute it. | There is NO WARRANTY, to the extent permitted by law. | | Written by John Gilmore and Jay Fenlason. | [command]/bin/tar xz --warning=no-unknown-keyword -C /tmp/temp_756265902 -f /tmp/83e9fe7b-9d34-482b-8dbb-66c619b5ba26 [t/test] 💬 ::debug::jdk extracted to /tmp/temp_756265902/zulu11.45.27-ca-jdk11.0.10-linux_x64 [t/test] 💬 ::debug::Caching tool jdk 11.0.10 x64 [t/test] 💬 ::debug::source dir: /tmp/temp_756265902/zulu11.45.27-ca-jdk11.0.10-linux_x64 [t/test] 💬 ::debug::destination /opt/hostedtoolcache/jdk/11.0.10/x64 [t/test] 💬 ::debug::finished caching tool [t/test] ⚙ ::add-path:: /opt/hostedtoolcache/jdk/11.0.10/x64/bin [t/test] ⚙ ::set-output:: path=/opt/hostedtoolcache/jdk/11.0.10/x64 [t/test] ⚙ ::set-output:: version=11.0.10 [t/test] ❓ ##[add-matcher]/actions/actions-setup-java@v1/.github/java.json | creating settings.xml with server-id: github; environment variables: username=$GITHUB_ACTOR, password=$GITHUB_TOKEN, and gpg-passphrase=null [t/test] 💬 ::debug::created directory /github/home/.m2 | writing /github/home/.m2/settings.xml [t/test] ✅ Success - actions/setup-java@v1 [t/test] ⭐ Run echo 'public class Test { public static void main(String[] args) { System.out.println("user.home: " + System.getProperty("user.home")); } }' >Test.java javac Test.java java Test id getent passwd $(id -u) echo "\$HOME=$HOME" | user.home: /root | uid=0(root) gid=0(root) groups=0(root) | root:x:0:0:root:/root:/bin/bash | $HOME=/github/home [t/test] ✅ Success - echo 'public class Test { public static void main(String[] args) { System.out.println("user.home: " + System.getProperty("user.home")); } }' >Test.java javac Test.java java Test id getent passwd $(id -u) echo "\$HOME=$HOME" ``` </details>
kerem 2026-03-01 21:42:56 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#389
No description provided.