History log of /freebsd-13.1/usr.bin/script/script.c (Results 1 – 25 of 51)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/12.4.0, release/13.1.0
# 6c12b392 08-Jan-2022 Konstantin Belousov <[email protected]>

script(1): work around slow reading child

PR: 260938

(cherry picked from commit c0ba4c2ee2c48ec9892d10c0aca797f3685c53ee)


Revision tags: release/12.3.0, release/13.0.0, release/12.2.0
# 84961358 05-Sep-2020 Warner Losh <[email protected]>

Fix typo in comment.

Noticed by: bapt@


# f9177b6c 01-Sep-2020 Warner Losh <[email protected]>

Have script accept and ignore -e for Linux compat

In the util-linux version of script, it will always exit with succes.
Except when run with -e, in which case it will have the exit value of
the chil

Have script accept and ignore -e for Linux compat

In the util-linux version of script, it will always exit with succes.
Except when run with -e, in which case it will have the exit value of
the child. BSD Script already uses the child's exit value for its exit
value. Some config and other helper scripts depend on being able to
specify -e. Accept it for compatibility since we'll already to the
right thing, but otherwise we ignore it.

show more ...


# 8bc30d2a 11-Aug-2020 Mark Johnston <[email protected]>

script: Minor cleanups.

- Instead of using isatty() to decide whether to call tcgetattr(), just
call tcgetattr() directly, since that's all that isatty() does anyway.
- Simplify error handling in

script: Minor cleanups.

- Instead of using isatty() to decide whether to call tcgetattr(), just
call tcgetattr() directly, since that's all that isatty() does anyway.
- Simplify error handling in termset(). Check for errno != ENOTTY from
tcgetattr() to handle errors that may be raised while running
script(1) under a debugger.

PR: 248377
Submitted by: Soumendra Ganguly <[email protected]>
MFC after: 1 week

show more ...


# 69bc4fa9 07-Aug-2020 Mark Johnston <[email protected]>

script: Put the terminal in raw mode when playing back a session.

Otherwise recorded sessions of some interactive programs do not play
back properly.

PR: 248377
Submitted by: Soumendra Ganguly <0.

script: Put the terminal in raw mode when playing back a session.

Otherwise recorded sessions of some interactive programs do not play
back properly.

PR: 248377
Submitted by: Soumendra Ganguly <[email protected]>
MFC after: 1 week

show more ...


Revision tags: release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0
# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <[email protected]>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier f

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

show more ...


Revision tags: release/10.4.0, release/11.1.0
# fbbd9655 28-Feb-2017 Warner Losh <[email protected]>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <[email protected]>
Pull Request: https://github.com/freebsd/freebsd/pull/96

show more ...


Revision tags: release/11.0.1, release/11.0.0
# 26e736b2 16-Apr-2016 Baptiste Daroussin <[email protected]>

Directly set the O_CLOEXEC flags via the open(2) attributes

MFC after: 1 week


Revision tags: release/10.3.0
# 66d93438 08-Mar-2016 Bryan Drewery <[email protected]>

Record command exit status in the typescript file when running simple commands.

Also capitalize 'command:'.

Relnotes: yes
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 95d13d1b 08-Mar-2016 Bryan Drewery <[email protected]>

Just exit in the child if execve(2) fails.

No functional change.

This is mostly addressing a false-positive from the clang static
analyzer due to it thinking that done() was being called with freed

Just exit in the child if execve(2) fails.

No functional change.

This is mostly addressing a false-positive from the clang static
analyzer due to it thinking that done() was being called with freed
memory, however the kill(0, SIGTERM) made the done() never reached.
It doesn't make sense to the show the footer from the child anyhow, nor
does it make sense to kill the process group here since the execve(2)
failed in the child. This code was leftover from many years of refactoring.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

show more ...


# 7b245cb8 08-Mar-2016 Bryan Drewery <[email protected]>

Filemon: Attach from the child to avoid racing with the parent attach.

This is the same as how the bmake filemon usage works.

This also fixes failed attach not properly flushing the TTY.

MFC after

Filemon: Attach from the child to avoid racing with the parent attach.

This is the same as how the bmake filemon usage works.

This also fixes failed attach not properly flushing the TTY.

MFC after: 1 week
Relnotes: yes
Sponsored by: EMC / Isilon Storage Division

show more ...


Revision tags: release/10.2.0, release/10.1.0, release/9.3.0
# 29f4384a 17-Jan-2014 Mikolaj Golub <[email protected]>

Bring back r226403, the fix for bin/161526, which was (accidentally?)
reverted in r238896.

PR: bin/161526
Reported by: Karli.Sjoberg slu.se
MFC after: 3 days


Revision tags: release/10.0.0
# 8d105abc 05-Dec-2013 Tom Rhodes <[email protected]>

Add -F to flush output after each write. With this, I can
set up a pipe and allow a jr user to watch what I'm doing
by running 'script -F pipefile' on it.

While here, spell out the month in the .Dd

Add -F to flush output after each write. With this, I can
set up a pipe and allow a jr user to watch what I'm doing
by running 'script -F pipefile' on it.

While here, spell out the month in the .Dd tag like other
manual pages.

show more ...


Revision tags: release/9.2.0, release/8.4.0, release/9.1.0
# 6cff4e07 26-Oct-2012 David E. O'Brien <[email protected]>

Add "-f" to also output filemon(4) information.


# 13f02f28 23-Oct-2012 David E. O'Brien <[email protected]>

Don't include both <sys/param.h> & <sys/types.h>.


# df53360c 30-Jul-2012 Brian Somers <[email protected]>

Add d, p and r switches for recording script sessions with timing data
and playing sessions back with or without time delays.

PR: 114465
Submitted by: ighighi at gmail dot com
MFC after: 3 weeks


Revision tags: release/8.3.0_cvs, release/8.3.0, release/9.0.0
# 8d105928 15-Oct-2011 Mikolaj Golub <[email protected]>

In r225809 the intention was to send VEOF only once if STDIN was not a
terminal. Unfortunately the fix was incorrect and for flushtime > 0 it
keept sending VEOF.

Sent VEOF generates ^D\b\b echoed by

In r225809 the intention was to send VEOF only once if STDIN was not a
terminal. Unfortunately the fix was incorrect and for flushtime > 0 it
keept sending VEOF.

Sent VEOF generates ^D\b\b echoed by the terminal, which was reported
in bin/161526. Note, we still send VEOF at least once. Otherwise
commands like below would hang forever:

echo 1 |script /tmp/script.out cat

PR: bin/161526
Reported by: Adrian Wontroba <[email protected]>, Stefan Bethke <[email protected]>
Tested by: Stefan Bethke <[email protected]>
MFC after: 3 days

show more ...


# 29da7547 27-Sep-2011 Mikolaj Golub <[email protected]>

When script(1) reads EOF from input it starts spinning on zero-byte
reads eating 100% CPU. Fix this by skipping select on STDIN after
reading EOF -- permanently if STDIN is not terminal and for one s

When script(1) reads EOF from input it starts spinning on zero-byte
reads eating 100% CPU. Fix this by skipping select on STDIN after
reading EOF -- permanently if STDIN is not terminal and for one second
if it is.

Also after reading EOF from STDIN we have to pass it to the program
being scripted. The previous approach was to write zero bytes into the
pseudo-terminal. This does not work because zero-byte write does not
have any effect on read. Fix this by sending VEOF instead.

Submitted by: Ronald Klop <[email protected]>
Discussed with: kib, Chris Torek <[email protected]>
Approved by: kib
MFC after: 1 week

show more ...


Revision tags: release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0
# da52b4ca 11-Dec-2010 Joel Dahl <[email protected]>

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $F

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with: imp, rwatson

show more ...


# 9b91846c 16-Sep-2010 David E. O'Brien <[email protected]>

+ Add the SCRIPT environmental variable to the sub-shell. Its value is
the name of the typescript file.
+ Add the 'command' argument (if supplied on the command line) to the
typescript file. This c

+ Add the SCRIPT environmental variable to the sub-shell. Its value is
the name of the typescript file.
+ Add the 'command' argument (if supplied on the command line) to the
typescript file. This creates a more complete typescript when invoked
this way - more equal to invoking script without supplying the 'command'
argument.

show more ...


# e8efeec6 16-Aug-2010 Ed Schouten <[email protected]>

Mark functions and variables as static.

All these functions and variables are local to this compilation unit, so
there is no reason why we shouldn't mark them static. This slightly
reduces the binar

Mark functions and variables as static.

All these functions and variables are local to this compilation unit, so
there is no reason why we shouldn't mark them static. This slightly
reduces the binary size.

show more ...


Revision tags: release/8.1.0_cvs, release/8.1.0
# 8f6794dd 14-May-2010 Ed Schouten <[email protected]>

MFC r207453:

Remove WNOHANG flag from wait3().

Because script(1) now reliably terminates when the TTY is closed, it may
be the case that the call to wait3() occurs just before the child
pro

MFC r207453:

Remove WNOHANG flag from wait3().

Because script(1) now reliably terminates when the TTY is closed, it may
be the case that the call to wait3() occurs just before the child
process exits. This causes error codes to be ignored.

Just change script(1) to use waitpid() instead of wait3(). This makes it
more portable and prevents the need for a loop, since waitpid() only
returns a specified process.

PR: bin/146189
Tested by: amdmi3@, older version

show more ...


# e1e9ba33 30-Apr-2010 Ed Schouten <[email protected]>

Remove WNOHANG flag from wait3().

Because script(1) now reliably terminates when the TTY is closed, it may
be the case that the call to wait3() occurs just before the child
process exits. This cause

Remove WNOHANG flag from wait3().

Because script(1) now reliably terminates when the TTY is closed, it may
be the case that the call to wait3() occurs just before the child
process exits. This causes error codes to be ignored.

Just change script(1) to use waitpid() instead of wait3(). This makes it
more portable and prevents the need for a loop, since waitpid() only
returns a specified process.

PR: bin/146189
Tested by: amdmi3@, older version
MFC after: 2 weeks

show more ...


# 4ae65fe9 25-Mar-2010 Ed Schouten <[email protected]>

MFC r205008 and 205009:

Make script(1) a little less broken.

Close the file descriptor to the TTY. There is no reason why the parent
process should keep track of the descriptor. This ensures

MFC r205008 and 205009:

Make script(1) a little less broken.

Close the file descriptor to the TTY. There is no reason why the parent
process should keep track of the descriptor. This ensures that the
application inside properly drains the TTY during exit(2).

Reported by: alfred

show more ...


Revision tags: release/7.3.0_cvs, release/7.3.0
# e8b9127d 11-Mar-2010 Ed Schouten <[email protected]>

Improve the change made in the previous commit.

doshell() never returns, so there is no need to see whether we are the
parent process.


123