Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some nits I found from older PRs #4320

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
}
p := spec.Process
p.Args = context.Args()[1:]
// override the cwd, if passed
if context.String("cwd") != "" {
p.Cwd = context.String("cwd")
// Override the cwd, if passed.
if cwd := context.String("cwd"); cwd != "" {
p.Cwd = cwd
}
if ap := context.String("apparmor"); ap != "" {
p.ApparmorProfile = ap
Expand All @@ -240,27 +240,24 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
// append the passed env variables
p.Env = append(p.Env, context.StringSlice("env")...)

// set the tty
p.Terminal = false
if context.IsSet("tty") {
p.Terminal = context.Bool("tty")
}
// Always set tty to false, unless explicitly enabled from CLI.
p.Terminal = context.Bool("tty")
if context.IsSet("no-new-privs") {
p.NoNewPrivileges = context.Bool("no-new-privs")
}
// override the user, if passed
if context.String("user") != "" {
u := strings.SplitN(context.String("user"), ":", 2)
// Override the user, if passed.
if user := context.String("user"); user != "" {
u := strings.SplitN(user, ":", 2)
if len(u) > 1 {
gid, err := strconv.Atoi(u[1])
if err != nil {
return nil, fmt.Errorf("parsing %s as int for gid failed: %w", u[1], err)
return nil, fmt.Errorf("bad gid: %w", err)
}
p.User.GID = uint32(gid)
}
uid, err := strconv.Atoi(u[0])
if err != nil {
return nil, fmt.Errorf("parsing %s as int for uid failed: %w", u[0], err)
return nil, fmt.Errorf("bad uid: %w", err)
}
p.User.UID = uint32(uid)
}
Expand Down
2 changes: 1 addition & 1 deletion script/keyring_validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ echo "------------------------------------------------------------"
gpg --show-keys <"$root/$project.keyring"
echo "------------------------------------------------------------"

# Check that each entry in the kering is actually a maintainer's key.
# Check that each entry in the keyring is actually a maintainer's key.
while IFS="" read -d $'\0' -r block || [ -n "$block" ]; do
username="$(sed -En "s|^Comment:.* github=(\w+).*|\1|p" <<<"$block")"

Expand Down
Loading