Skip to content

Commit

Permalink
Document fork, exec, wait and redirect2null Lua functions as deprecated
Browse files Browse the repository at this point in the history
Rpm scriptlets should have no business dealing with this level of
detail in process control, rpm.execut() is much saner and safer
for scriptlet needs. We can't just remove because this is a public
API with known users (eg glibc in Fedora), but we can at least document
these as deprecated.

fork() and exec() are the main "problems" here, but wait() and
redirect2null() become meaningless once you take the first two away.

Fixes: rpm-software-management#2420
  • Loading branch information
pmatilai committed Mar 6, 2024
1 parent 0f07d3e commit 85b5ea6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions docs/manual/lua.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ f = f:reopen('r.gzdio')
print(f:read())}
```

#### redirect2null(fdno)
#### redirect2null(fdno) (DEPRECATED)

Redirect file descriptor fdno to /dev/null (rpm >= 4.16, in rpm 4.13-4.15
this was known as posix.redirect2null())
Expand All @@ -307,6 +307,8 @@ elseif pid > 0 then
end
```

This function is deprecated, use `rpm.execute()` instead.

#### undefine(name)

Undefine a macro (rpm >= 4.14.0)
Expand Down Expand Up @@ -440,10 +442,10 @@ if not posix.chmod(f, 100) then
end
```

#### exec(path [, args...])
#### exec(path [, args...]) (DEPRECATED)

Execute a program. This may only be performed after posix.fork().
For executing external commands it's recommended to use `rpm.execute()` instead.
This function is deprecated, use `rpm.execute()` instead.

#### files([path])

Expand All @@ -456,10 +458,10 @@ for f in posix.files('/') do
end
```

#### fork()
#### fork() (DEPRECATED)

Fork a new process.
For executing external commands it's recommended to use `rpm.execute()` instead.
This function is deprecated, use `rpm.execute()` instead.

```
pid = posix.fork()
Expand Down Expand Up @@ -724,7 +726,7 @@ posix.mkdir('aaa')
posix.utime('aaa', 0, 0)
```

#### wait([pid])
#### wait([pid]) (DEPRECATED)

Wait for a child process. If pid is specified wait for that particular child.

Expand All @@ -737,6 +739,8 @@ elseif pid > 0 then
end
```

This function is deprecated, use `rpm.execute()` instead.

#### setenv(name, value [, overwrite])

Change or add an environment variable. The optional overwrite is a boolean
Expand Down

0 comments on commit 85b5ea6

Please sign in to comment.