Skip to content

Commit

Permalink
Fix empty user's shell field in /etc/passwd
Browse files Browse the repository at this point in the history
This regression was introduced by 4a0d2b81b1c2784d7df196575dfffb47478532a7

Signed-off-by: Dennis Klein <[email protected]>
  • Loading branch information
dennisklein authored and dtrudg committed Sep 13, 2024
1 parent a33c2b6 commit 2820d64
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Changes Since Last Release

### Bug Fixes

- Fix regression that led to an empty shell field in the `/etc/passwd` file.

## 4.2.0 \[2024-09-04\]

### New Features & Functionality
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The following have contributed code and/or documentation to this repository.
- Dave Godlove <[email protected]>, <[email protected]>
- Dave Love <[email protected]>
- David Trudgian <[email protected]>, <[email protected]>
- Dennis Klein <[email protected]>
- Diana Langenbach <[email protected]>
- Dimitri Papadopoulos <[email protected]>
- Divya Cote <[email protected]>
Expand Down
11 changes: 4 additions & 7 deletions internal/pkg/runtime/engine/singularity/prepare_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1547,17 +1547,14 @@ func (e *EngineOperations) setUserInfo(useTargetIDs bool) {

if useTargetIDs {
pw, err = user.GetPwUID(uint32(e.EngineConfig.GetTargetUID()))
if err == nil {
e.EngineConfig.JSON.UserInfo.Username = pw.Name
e.EngineConfig.JSON.UserInfo.Gecos = pw.Gecos
e.EngineConfig.JSON.UserInfo.UID = int(pw.UID)
e.EngineConfig.JSON.UserInfo.GID = int(pw.GID)
}
} else {
}

if err == nil {
e.EngineConfig.JSON.UserInfo.Username = pw.Name
e.EngineConfig.JSON.UserInfo.Gecos = pw.Gecos
e.EngineConfig.JSON.UserInfo.UID = int(pw.UID)
e.EngineConfig.JSON.UserInfo.GID = int(pw.GID)
e.EngineConfig.JSON.UserInfo.Shell = pw.Shell
}

e.EngineConfig.JSON.UserInfo.Groups = make(map[int]string)
Expand Down

0 comments on commit 2820d64

Please sign in to comment.