Merge branch 'master' into master

This commit is contained in:
Rmys
2023-01-05 12:13:35 +03:00
committed by GitHub
168 changed files with 350498 additions and 3367 deletions
+2 -2
View File
@@ -28,9 +28,9 @@ def install():
# Dirty fix for now... (especially for flatpak)
shelltools.system("mv %s/run/* %s/dev" % (get.installDIR(), get.installDIR()))
pisitools.remove("/var/lock")
# pisitools.remove("/var/lock")
# shelltools.cd("%s/var" % get.installDIR())
shelltools.system("ln -rs %s/dev/lock %s/var/lock" % (get.installDIR(), get.installDIR()))
# shelltools.system("ln -rs %s/dev/lock %s/var/lock" % (get.installDIR(), get.installDIR()))
# shelltools.cd("%s/baselayout/src" % get.workDIR())
# Adjust permissions
+7
View File
@@ -72,6 +72,13 @@
</Package>
<History>
<Update release="20">
<Date>2022-11-20</Date>
<Version>3.10.1</Version>
<Comment>Rebuild.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="19">
<Date>2022-10-01</Date>
<Version>3.10.1</Version>
@@ -1,11 +1,12 @@
--- bash-2.05b/aclocal.m4.pgrp_sync 2002-06-25 14:45:43.000000000 +0100
+++ bash-2.05b/aclocal.m4 2003-01-15 18:17:35.000000000 +0000
@@ -1255,7 +1255,7 @@
diff --git a/aclocal.m4 b/aclocal.m4
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1324,7 +1324,7 @@ main()
wait(&status);
exit(ok ? 0 : 5);
}
-], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
+], bash_cv_pgrp_pipe=yes,bash_cv_pgrp_pipe=yes,
-]])], [bash_cv_pgrp_pipe=no], [bash_cv_pgrp_pipe=yes],
+]])], [bash_cv_pgrp_pipe=yes], [bash_cv_pgrp_pipe=yes],
[AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
bash_cv_pgrp_pipe=no])
])
bash_cv_pgrp_pipe=no]
)])
@@ -1,18 +1,18 @@
diff -up bash-4.1/examples/loadables/Makefile.in.examples bash-4.1/examples/loadables/Makefile.in
--- bash-4.1/examples/loadables/Makefile.in.examples 2010-06-22 16:20:02.000000000 +0200
+++ bash-4.1/examples/loadables/Makefile.in 2010-06-22 16:20:41.000000000 +0200
@@ -43,7 +43,7 @@ host_os = @host_os@
host_cpu = @host_cpu@
diff --git a/examples/loadables/Makefile.in b/examples/loadables/Makefile.in
--- a/examples/loadables/Makefile.in
+++ b/examples/loadables/Makefile.in
@@ -59,7 +59,7 @@ host_cpu = @host_cpu@
host_vendor = @host_vendor@
STYLE_CFLAGS = @STYLE_CFLAGS@
-CFLAGS = @CFLAGS@
+CFLAGS = -O2 -g
++CFLAGS = -O2 -g
LOCAL_CFLAGS = @LOCAL_CFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
diff -up bash-4.1/examples/loadables/perl/Makefile.in.examples bash-4.1/examples/loadables/perl/Makefile.in
--- bash-4.1/examples/loadables/perl/Makefile.in.examples 2010-06-22 16:20:46.000000000 +0200
+++ bash-4.1/examples/loadables/perl/Makefile.in 2010-06-22 16:21:04.000000000 +0200
diff --git a/examples/loadables/perl/Makefile.in b/examples/loadables/perl/Makefile.in
--- a/examples/loadables/perl/Makefile.in
+++ b/examples/loadables/perl/Makefile.in
@@ -42,7 +42,7 @@ SHELL = @MAKE_SHELL@
PERL5 = perl5
@@ -1,21 +1,20 @@
diff --git a/parse.y b/parse.y
index df1231d..2449fa8 100644
--- a/parse.y
+++ b/parse.y
@@ -4482,6 +4482,8 @@ xparse_dolparen (base, string, indp, flags)
@@ -4255,7 +4255,8 @@ xparse_dolparen (base, string, indp, flags)
save_parser_state (&ps);
save_input_line_state (&ls);
orig_eof_token = shell_eof_token;
-
+ /* avoid echoing every substitution again */
+ echo_input_at_read = 0;
#if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
saved_pushed_strings = pushed_string_list; /* separate parsing context */
pushed_string_list = (STRING_SAVER *)NULL;
#endif
diff --git a/subst.c b/subst.c
index 9ccbf33..8a9ee5c 100644
--- a/subst.c
+++ b/subst.c
@@ -9453,6 +9453,7 @@ param_expand (string, sindex, quoted, expanded_something,
@@ -10222,6 +10222,7 @@ param_expand (string, sindex, quoted, expanded_something,
WORD_LIST *list, *l;
WORD_DESC *tdesc, *ret;
int tflag, nullarg;
@@ -23,7 +22,7 @@ index 9ccbf33..8a9ee5c 100644
/*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/
zindex = *sindex;
@@ -9843,6 +9844,9 @@ arithsub:
@@ -10614,6 +10615,9 @@ arithsub:
}
comsub:
@@ -33,7 +32,7 @@ index 9ccbf33..8a9ee5c 100644
if (pflags & PF_NOCOMSUB)
/* we need zindex+1 because string[zindex] == RPAREN */
temp1 = substring (string, *sindex, zindex+1);
@@ -9855,6 +9859,7 @@ comsub:
@@ -10626,6 +10630,7 @@ comsub:
}
FREE (temp);
temp = temp1;
@@ -0,0 +1,13 @@
diff --git a/doc/bash.1 b/doc/bash.1
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -10726,6 +10726,9 @@ If set, the shell automatically closes file descriptors assigned using the
.el above)
instead of leaving them open when the command completes.
.TP 8
+.B syslog_history
+If set, command history is logged to syslog.
+.TP 8
.B xpg_echo
If set, the \fBecho\fP builtin expands backslash-escape sequences
by default.
@@ -1,20 +1,18 @@
diff --git a/builtins.h b/builtins.h
index dac95fd..5b7e811 100644
--- a/builtins.h
+++ b/builtins.h
@@ -45,6 +45,7 @@
#define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */
@@ -46,6 +46,7 @@
#define POSIX_BUILTIN 0x20 /* This builtins is special in the Posix command search order. */
#define LOCALVAR_BUILTIN 0x40 /* This builtin creates local variables */
+#define REQUIRES_BUILTIN 0x80 /* This builtin requires other files. */
#define ARRAYREF_BUILTIN 0x80 /* This builtin takes array references as arguments */
+#define REQUIRES_BUILTIN 0x100 /* This builtin requires other files. */
#define BASE_INDENT 4
diff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c
index e243021..0a7a0e5 100644
--- a/builtins/mkbuiltins.c
+++ b/builtins/mkbuiltins.c
@@ -69,10 +69,15 @@ extern char *strcpy ();
@@ -69,11 +69,16 @@ extern char *strcpy ();
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
/* Flag values that builtins can have. */
@@ -25,15 +23,18 @@ index e243021..0a7a0e5 100644
#define BUILTIN_FLAG_SPECIAL 0x01
#define BUILTIN_FLAG_ASSIGNMENT 0x02
#define BUILTIN_FLAG_LOCALVAR 0x04
#define BUILTIN_FLAG_POSIX_BUILTIN 0x08
+#define BUILTIN_FLAG_REQUIRES 0x10
#define BUILTIN_FLAG_POSIX_BUILTIN 0x08
#define BUILTIN_FLAG_ARRAYREF_ARG 0x10
+#define BUILTIN_FLAG_REQUIRES 0x20
#define BASE_INDENT 4
@@ -173,11 +178,19 @@ char *posix_builtins[] =
@@ -189,13 +194,21 @@ char *arrayvar_builtins[] =
"typeset", "unset", "wait", /*]*/
(char *)NULL
};
-
+
+/* The builtin commands that cause requirements on other files. */
+static char *requires_builtins[] =
+{
@@ -46,36 +47,38 @@ index e243021..0a7a0e5 100644
static int is_assignment_builtin ();
static int is_localvar_builtin ();
static int is_posix_builtin ();
static int is_arrayvar_builtin ();
+static int is_requires_builtin ();
#if !defined (HAVE_RENAME)
static int rename ();
@@ -831,6 +844,8 @@ builtin_handler (self, defs, arg)
new->flags |= BUILTIN_FLAG_LOCALVAR;
if (is_posix_builtin (name))
@@ -856,6 +869,8 @@ builtin_handler (self, defs, arg)
new->flags |= BUILTIN_FLAG_POSIX_BUILTIN;
if (is_arrayvar_builtin (name))
new->flags |= BUILTIN_FLAG_ARRAYREF_ARG;
+ if (is_requires_builtin (name))
+ new->flags |= BUILTIN_FLAG_REQUIRES;
array_add ((char *)new, defs->builtins);
building_builtin = 1;
@@ -1250,12 +1265,13 @@ write_builtins (defs, structfile, externfile)
@@ -1275,13 +1290,14 @@ write_builtins (defs, structfile, externfile)
else
fprintf (structfile, "(sh_builtin_func_t *)0x0, ");
- fprintf (structfile, "%s%s%s%s%s, %s_doc,\n",
+ fprintf (structfile, "%s%s%s%s%s%s, %s_doc,\n",
- fprintf (structfile, "%s%s%s%s%s%s, %s_doc,\n",
+ fprintf (structfile, "%s%s%s%s%s%s%s, %s_doc,\n",
"BUILTIN_ENABLED | STATIC_BUILTIN",
(builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_LOCALVAR) ? " | LOCALVAR_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_POSIX_BUILTIN) ? " | POSIX_BUILTIN" : "",
(builtin->flags & BUILTIN_FLAG_ARRAYREF_ARG) ? " | ARRAYREF_BUILTIN" : "",
+ (builtin->flags & BUILTIN_FLAG_REQUIRES) ? " | REQUIRES_BUILTIN" : "",
document_name (builtin));
/* Don't translate short document summaries that are identical
@@ -1645,6 +1661,13 @@ is_posix_builtin (name)
return (_find_in_table (name, posix_builtins));
@@ -1678,6 +1694,13 @@ is_arrayvar_builtin (name)
return (_find_in_table (name, arrayvar_builtins));
}
+static int
@@ -89,7 +92,6 @@ index e243021..0a7a0e5 100644
static int
rename (from, to)
diff --git a/doc/bash.1 b/doc/bash.1
index 5af7d42..7539368 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -239,6 +239,14 @@ The shell becomes restricted (see
@@ -108,10 +110,9 @@ index 5af7d42..7539368 100644
Equivalent to \fB\-v\fP.
.TP
diff --git a/doc/bashref.texi b/doc/bashref.texi
index 9e23f58..d02151e 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -6554,6 +6554,13 @@ standard. @xref{Bash POSIX Mode}, for a description of the Bash
@@ -6927,6 +6927,13 @@ standard. @xref{Bash POSIX Mode}, for a description of the Bash
@item --restricted
Make the shell a restricted shell (@pxref{The Restricted Shell}).
@@ -126,10 +127,9 @@ index 9e23f58..d02151e 100644
Equivalent to @option{-v}. Print shell input lines as they're read.
diff --git a/eval.c b/eval.c
index 1d967da..f197033 100644
--- a/eval.c
+++ b/eval.c
@@ -137,7 +137,8 @@ reader_loop ()
@@ -138,7 +138,8 @@ reader_loop ()
if (read_command () == 0)
{
@@ -137,13 +137,12 @@ index 1d967da..f197033 100644
+
+ if (interactive_shell == 0 && (read_but_dont_execute && !rpm_requires))
{
set_exit_status (EXECUTION_SUCCESS);
set_exit_status (last_command_exit_value);
dispose_command (global_command);
diff --git a/execute_cmd.c b/execute_cmd.c
index d2555ad..397e283 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -543,6 +543,8 @@ async_redirect_stdin ()
@@ -561,6 +561,8 @@ async_redirect_stdin ()
#define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0)
@@ -152,22 +151,22 @@ index d2555ad..397e283 100644
/* Execute the command passed in COMMAND, perhaps doing it asynchronously.
COMMAND is exactly what read_command () places into GLOBAL_COMMAND.
ASYNCHRONOUS, if non-zero, says to do this command in the background.
@@ -574,7 +576,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
@@ -592,7 +594,13 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
if (breaking || continuing)
return (last_command_exit_value);
- if (command == 0 || read_but_dont_execute)
- if (read_but_dont_execute)
+ if (command == 0 || (read_but_dont_execute && !rpm_requires))
+ return (EXECUTION_SUCCESS);
+ if (rpm_requires && command->type == cm_function_def)
+ return last_command_exit_value =
+ execute_intern_function (command->value.Function_def->name,
+ command->value.Function_def);
+ if (read_but_dont_execute)
+ if (read_but_dont_execute)
return (last_command_exit_value);
if (command == 0)
return (EXECUTION_SUCCESS);
QUIT;
@@ -2836,7 +2844,7 @@ execute_for_command (for_command)
@@ -2883,7 +2891,7 @@ execute_for_command (for_command)
save_line_number = line_number;
if (check_identifier (for_command->name, 1) == 0)
{
@@ -177,7 +176,6 @@ index d2555ad..397e283 100644
last_command_exit_value = EX_BADUSAGE;
jump_to_top_level (ERREXIT);
diff --git a/execute_cmd.h b/execute_cmd.h
index 465030a..9c7fd1c 100644
--- a/execute_cmd.h
+++ b/execute_cmd.h
@@ -22,6 +22,9 @@
@@ -191,7 +189,6 @@ index 465030a..9c7fd1c 100644
#if defined (ARRAY_VARS)
struct func_array_state
diff --git a/make_cmd.c b/make_cmd.c
index 2d7ac96..ac53526 100644
--- a/make_cmd.c
+++ b/make_cmd.c
@@ -35,6 +35,8 @@
@@ -203,7 +200,7 @@ index 2d7ac96..ac53526 100644
#include "execute_cmd.h"
#include "parser.h"
#include "flags.h"
@@ -828,6 +830,30 @@ make_coproc_command (name, command)
@@ -839,6 +841,30 @@ make_coproc_command (name, command)
return (make_command (cm_coproc, (SIMPLE_COM *)temp));
}
@@ -234,7 +231,7 @@ index 2d7ac96..ac53526 100644
/* Reverse the word list and redirection list in the simple command
has just been parsed. It seems simpler to do this here the one
time then by any other method that I can think of. */
@@ -845,6 +871,28 @@ clean_simple_command (command)
@@ -856,6 +882,28 @@ clean_simple_command (command)
REVERSE_LIST (command->value.Simple->redirects, REDIRECT *);
}
@@ -264,10 +261,9 @@ index 2d7ac96..ac53526 100644
return (command);
}
diff --git a/shell.c b/shell.c
index ce8087f..7dcd000 100644
--- a/shell.c
+++ b/shell.c
@@ -194,6 +194,9 @@ int have_devfd = 0;
@@ -196,6 +196,9 @@ int have_devfd = 0;
/* The name of the .(shell)rc file. */
static char *bashrc_file = DEFAULT_BASHRC;
@@ -277,7 +273,7 @@ index ce8087f..7dcd000 100644
/* Non-zero means to act more like the Bourne shell on startup. */
static int act_like_sh;
@@ -260,6 +263,7 @@ static const struct {
@@ -266,6 +269,7 @@ static const struct {
{ "protected", Int, &protected_mode, (char **)0x0 },
#endif
{ "rcfile", Charp, (int *)0x0, &bashrc_file },
@@ -285,9 +281,9 @@ index ce8087f..7dcd000 100644
#if defined (RESTRICTED_SHELL)
{ "restricted", Int, &restricted, (char **)0x0 },
#endif
@@ -502,6 +506,12 @@ main (argc, argv, env)
if (dump_translatable_strings)
@@ -510,6 +514,12 @@ main (argc, argv, env)
read_but_dont_execute = 1;
#endif
+ if (rpm_requires)
+ {
@@ -299,10 +295,9 @@ index ce8087f..7dcd000 100644
disable_priv_mode ();
diff --git a/shell.h b/shell.h
index 8b41792..29b0efb 100644
--- a/shell.h
+++ b/shell.h
@@ -99,6 +99,7 @@ extern int interactive, interactive_shell;
@@ -100,6 +100,7 @@ extern int interactive, interactive_shell;
extern int startup_state;
extern int reading_shell_script;
extern int shell_initialized;
@@ -1,8 +1,7 @@
diff --git a/tests/exec.right b/tests/exec.right
index 0a249dd..fe8a127 100644
--- a/tests/exec.right
+++ b/tests/exec.right
@@ -51,7 +51,6 @@ this is ohio-state
@@ -60,7 +60,6 @@ this is ohio-state
0
1
testb
@@ -11,7 +10,6 @@ index 0a249dd..fe8a127 100644
1
1
diff --git a/tests/execscript b/tests/execscript
index 2809676..1216828 100644
--- a/tests/execscript
+++ b/tests/execscript
@@ -108,8 +108,6 @@ ${THIS_SH} ./exec6.sub
@@ -24,26 +22,27 @@ index 2809676..1216828 100644
${THIS_SH} ./exec10.sub
diff --git a/tests/read.right b/tests/read.right
index 1144083..09cd422 100644
--- a/tests/read.right
+++ b/tests/read.right
@@ -33,14 +33,6 @@ a = abcdefg
@@ -34,17 +34,6 @@ xyz
a = xyz
a = -xyz 123-
a = abc
-timeout 1: ok
-
-unset or null 1
-timeout 2: ok
-
-./read2.sub: line 36: read: -3: invalid timeout specification
-unset or null 2
-timeout 3: ok
-unset or null 3
-./read2.sub: line 45: read: -3: invalid timeout specification
-1
-
-abcde
-abcde
./read3.sub: line 17: read: -1: invalid number
abc
ab
defg
diff --git a/tests/read.tests b/tests/read.tests
index 7384f05..43fcf8d 100644
--- a/tests/read.tests
+++ b/tests/read.tests
@@ -95,9 +95,6 @@ echo " foo" | { IFS=$':' ; read line; recho "$line"; }
@@ -0,0 +1,46 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-001
Bug-Reported-by: Emanuele Torre <torreemanuele6@gmail.com>
Bug-Reference-ID: <CAA7hNqeR1eSdiGK8mjQSqJPo815JYoG-Ekz-5PrAJTEYy2e6hg@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-09/msg00060.html
Bug-Description:
Expanding unset arrays in an arithmetic context can cause a segmentation fault.
Patch (apply with `patch -p0'):
*** ../bash-5.2/subst.c 2022-08-31 17:36:46.000000000 -0400
--- subst.c 2022-09-30 09:12:05.000000000 -0400
***************
*** 10858,10862 ****
t = expand_subscript_string (exp, quoted & ~(Q_ARITH|Q_DOUBLE_QUOTES));
free (exp);
! exp = sh_backslash_quote (t, abstab, 0);
free (t);
--- 10858,10862 ----
t = expand_subscript_string (exp, quoted & ~(Q_ARITH|Q_DOUBLE_QUOTES));
free (exp);
! exp = t ? sh_backslash_quote (t, abstab, 0) : savestring ("");
free (t);
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 0
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,46 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-002
Bug-Reported-by: Kan-Ru Chen <koster@debian.org>
Bug-Reference-ID:
Bug-Reference-URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021109
Bug-Description:
Starting bash with an invalid locale specification for LC_ALL/LANG/LC_CTYPE
can cause the shell to crash.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/lib/readline/nls.c 2022-08-15 09:38:51.000000000 -0400
--- lib/readline/nls.c 2022-10-05 09:23:22.000000000 -0400
***************
*** 142,145 ****
--- 142,149 ----
lspec = "";
ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
+ if (ret == 0 || *ret == 0)
+ ret = setlocale (LC_CTYPE, (char *)NULL);
+ if (ret == 0 || *ret == 0)
+ ret = RL_DEFAULT_LOCALE;
#else
ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,89 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-003
Bug-Reported-by: D630 <d630@posteo.net>
Bug-Reference-ID: <cf8523d58ac75b9ffba9519faa175618@posteo.de>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00092.html
Bug-Description:
Command substitutions need to preserve newlines instead of replacing them
with semicolons, especially in the presence of multiple here-documents.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/print_cmd.c 2022-07-26 09:16:39.000000000 -0400
--- print_cmd.c 2022-10-17 10:41:06.000000000 -0400
***************
*** 298,305 ****
--- 298,307 ----
{
char c = command->value.Connection->connector;
+ int was_newline;
s[0] = printing_comsub ? c : ';';
s[1] = '\0';
+ was_newline = deferred_heredocs == 0 && was_heredoc == 0 && c == '\n';
if (deferred_heredocs == 0)
{
***************
*** 315,318 ****
--- 317,322 ----
if (inside_function_def)
cprintf ("\n");
+ else if (printing_comsub && c == '\n' && was_newline == 0)
+ cprintf ("\n"); /* preserve newlines in comsubs but don't double them */
else
{
***************
*** 1366,1370 ****
}
else
! newline ("}");
dispose_command (cmdcopy);
--- 1371,1379 ----
}
else
! {
! /* { */
! newline ("}");
! was_heredoc = 0; /* not printing any here-documents now */
! }
dispose_command (cmdcopy);
***************
*** 1443,1447 ****
}
else
! newline ("}");
result = the_printed_command;
--- 1452,1459 ----
}
else
! { /* { */
! newline ("}");
! was_heredoc = 0;
! }
result = the_printed_command;
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,70 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-004
Bug-Reported-by: Antoine <bug-bash@glitchimini.net>
Bug-Reference-ID: <8bd59753-05ff-9b09-2337-2c7f52ded650@glitchimini.net>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00022.html
Bug-Description:
Bash needs to keep better track of nested brace expansions to avoid problems
with quoting and POSIX semantics.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/subst.c 2022-10-05 10:22:02.000000000 -0400
--- subst.c 2022-10-06 15:19:08.000000000 -0400
***************
*** 1799,1802 ****
--- 1804,1810 ----
}
+ #define PARAMEXPNEST_MAX 32 // for now
+ static int dbstate[PARAMEXPNEST_MAX];
+
/* Extract a parameter expansion expression within ${ and } from STRING.
Obey the Posix.2 rules for finding the ending `}': count braces while
***************
*** 1829,1832 ****
--- 1837,1842 ----
return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));
+ dbstate[0] = dolbrace_state;
+
pass_character = 0;
nesting_level = 1;
***************
*** 1853,1856 ****
--- 1863,1868 ----
if (string[i] == '$' && string[i+1] == LBRACE)
{
+ if (nesting_level < PARAMEXPNEST_MAX)
+ dbstate[nesting_level] = dolbrace_state;
nesting_level++;
i += 2;
***************
*** 1865,1868 ****
--- 1877,1881 ----
if (nesting_level == 0)
break;
+ dolbrace_state = (nesting_level < PARAMEXPNEST_MAX) ? dbstate[nesting_level] : dbstate[0]; /* Guess using initial state */
i++;
continue;
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,47 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-005
Bug-Reported-by: Justin Wood (Callek) <callek@gmail.com>
Bug-Reference-ID: <CANBDKY9fp2yiXONP7RY4kNuRteuovUebxSJaqePHeu7cyaFS9Q@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00088.html
Bug-Description:
Null pattern substitution replacement strings can cause a crash.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/subst.c 2022-10-05 10:22:02.000000000 -0400
--- subst.c 2022-10-13 16:57:26.000000000 -0400
***************
*** 8966,8970 ****
}
else if (*string == 0 && (match_pattern (string, pat, mtype, &s, &e) != 0))
! return ((mflags & MATCH_EXPREP) ? strcreplace (rep, '&', "", 2) : savestring (rep));
ret = (char *)xmalloc (rsize = 64);
--- 8966,8971 ----
}
else if (*string == 0 && (match_pattern (string, pat, mtype, &s, &e) != 0))
! return (mflags & MATCH_EXPREP) ? strcreplace (rep, '&', "", 2)
! : (rep ? savestring (rep) : savestring (""));
ret = (char *)xmalloc (rsize = 64);
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 5
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,293 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-006
Bug-Reported-by: feng xiangjun <fengxj325@gmail.com>
Bug-Reference-ID: <CAHH2t87LrCmO=gdyWOmGn5WJt7EucL+iOXzrry34OETe50S6uA@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00089.html
Bug-Description:
In interactive shells, interrupting the shell while entering a command
substitution can inhibit alias expansion.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/parse.y 2022-10-08 13:10:06.000000000 -0400
--- parse.y 2022-10-14 10:03:19.000000000 -0400
***************
*** 3307,3310 ****
--- 3307,3312 ----
extended_glob = global_extglob;
#endif
+ if (parser_state & (PST_CMDSUBST|PST_STRING))
+ expand_aliases = expaliases_flag;
parser_state = 0;
***************
*** 4389,4392 ****
--- 4391,4395 ----
parser_state |= PST_NOERROR;
+ parser_state |= PST_STRING;
expand_aliases = 0;
***************
*** 6402,6406 ****
parser_state &= ~PST_NOEXPAND; /* parse_comsub sentinel */
/* State flags we want to set for this run through the tokenizer. */
! parser_state |= PST_COMPASSIGN|PST_REPARSE;
}
--- 6405,6409 ----
parser_state &= ~PST_NOEXPAND; /* parse_comsub sentinel */
/* State flags we want to set for this run through the tokenizer. */
! parser_state |= PST_COMPASSIGN|PST_REPARSE|PST_STRING;
}
*** ../bash-20221007/parser.h 2022-08-30 11:39:56.000000000 -0400
--- parser.h 2022-10-14 09:56:18.000000000 -0400
***************
*** 51,54 ****
--- 51,55 ----
#define PST_NOEXPAND 0x400000 /* don't expand anything in read_token_word; for command substitution */
#define PST_NOERROR 0x800000 /* don't print error messages in yyerror */
+ #define PST_STRING 0x1000000 /* parsing a string to a command or word list */
/* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
*** ../bash-20221007/builtins/shopt.def 2022-10-07 10:25:55.000000000 -0400
--- builtins/shopt.def 2022-10-14 09:30:11.000000000 -0400
***************
*** 150,153 ****
--- 150,156 ----
#endif
+ int expaliases_flag = 0;
+ static int shopt_set_expaliases PARAMS((char *, int));
+
static int shopt_set_debug_mode PARAMS((char *, int));
***************
*** 199,203 ****
{ "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
{ "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
! { "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL },
#if defined (DEBUGGER)
{ "extdebug", &debugging_mode, shopt_set_debug_mode },
--- 202,206 ----
{ "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
{ "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
! { "expand_aliases", &expaliases_flag, shopt_set_expaliases },
#if defined (DEBUGGER)
{ "extdebug", &debugging_mode, shopt_set_debug_mode },
***************
*** 351,355 ****
allow_null_glob_expansion = glob_dot_filenames = 0;
no_exit_on_failed_exec = 0;
! expand_aliases = 0;
extended_quote = 1;
fail_glob_expansion = 0;
--- 354,358 ----
allow_null_glob_expansion = glob_dot_filenames = 0;
no_exit_on_failed_exec = 0;
! expand_aliases = expaliases_flag = 0;
extended_quote = 1;
fail_glob_expansion = 0;
***************
*** 632,635 ****
--- 635,647 ----
}
+ static int
+ shopt_set_expaliases (option_name, mode)
+ char *option_name;
+ int mode;
+ {
+ expand_aliases = expaliases_flag;
+ return 0;
+ }
+
#if defined (READLINE)
static int
*** ../bash-20221007/builtins/common.h 2022-10-07 10:10:17.000000000 -0400
--- builtins/common.h 2022-10-14 09:29:25.000000000 -0400
***************
*** 258,261 ****
--- 258,263 ----
#endif
+ extern int expaliases_flag;
+
/* variables from source.def */
extern int source_searches_cwd;
*** ../bash-20221007/execute_cmd.c 2022-10-10 10:48:54.000000000 -0400
--- execute_cmd.c 2022-10-14 09:32:24.000000000 -0400
***************
*** 1537,1541 ****
aliases. */
if (ois != interactive_shell)
! expand_aliases = 0;
}
--- 1537,1541 ----
aliases. */
if (ois != interactive_shell)
! expand_aliases = expaliases_flag = 0;
}
*** ../bash-20221007/general.c 2021-11-04 14:12:38.000000000 -0400
--- general.c 2022-10-14 09:34:24.000000000 -0400
***************
*** 92,96 ****
&interactive_comments,
&source_uses_path,
! &expand_aliases,
&inherit_errexit,
&print_shift_error,
--- 92,96 ----
&interactive_comments,
&source_uses_path,
! &expaliases_flag,
&inherit_errexit,
&print_shift_error,
***************
*** 107,111 ****
if (on != 0)
{
! interactive_comments = source_uses_path = expand_aliases = 1;
inherit_errexit = 1;
source_searches_cwd = 0;
--- 107,112 ----
if (on != 0)
{
! interactive_comments = source_uses_path = 1;
! expand_aliases = expaliases_flag = 1;
inherit_errexit = 1;
source_searches_cwd = 0;
***************
*** 117,120 ****
--- 118,122 ----
{
set_posix_options (saved_posix_vars);
+ expand_aliases = expaliases_flag;
free (saved_posix_vars);
saved_posix_vars = 0;
***************
*** 123,127 ****
{
source_searches_cwd = 1;
! expand_aliases = interactive_shell;
print_shift_error = 0;
}
--- 125,129 ----
{
source_searches_cwd = 1;
! expand_aliases = expaliases_flag = interactive_shell; /* XXX */
print_shift_error = 0;
}
*** ../bash-5.2-patched/shell.c 2022-03-04 15:13:00.000000000 -0500
--- shell.c 2022-10-14 09:36:19.000000000 -0400
***************
*** 1845,1850 ****
init_interactive ()
{
! expand_aliases = interactive_shell = startup_state = 1;
! interactive = 1;
#if defined (HISTORY)
if (enable_history_list == -1)
--- 1845,1850 ----
init_interactive ()
{
! expand_aliases = expaliases_flag = 1;
! interactive_shell = startup_state = interactive = 1;
#if defined (HISTORY)
if (enable_history_list == -1)
***************
*** 1866,1870 ****
#endif /* HISTORY */
interactive_shell = startup_state = interactive = 0;
! expand_aliases = posixly_correct; /* XXX - was 0 not posixly_correct */
no_line_editing = 1;
#if defined (JOB_CONTROL)
--- 1866,1870 ----
#endif /* HISTORY */
interactive_shell = startup_state = interactive = 0;
! expand_aliases = expaliases_flag = posixly_correct; /* XXX - was 0 not posixly_correct */
no_line_editing = 1;
#if defined (JOB_CONTROL)
***************
*** 1883,1887 ****
#endif
init_noninteractive ();
! expand_aliases = interactive_shell = startup_state = 1;
#if defined (HISTORY)
remember_on_history = enable_history_list; /* XXX */
--- 1883,1887 ----
#endif
init_noninteractive ();
! expand_aliases = expaliases_flag = interactive_shell = startup_state = 1;
#if defined (HISTORY)
remember_on_history = enable_history_list; /* XXX */
***************
*** 2026,2030 ****
forced_interactive = interactive_shell = 0;
subshell_environment = running_in_background = 0;
! expand_aliases = 0;
bash_argv_initialized = 0;
--- 2026,2030 ----
forced_interactive = interactive_shell = 0;
subshell_environment = running_in_background = 0;
! expand_aliases = expaliases_flag = 0;
bash_argv_initialized = 0;
*** ../bash-5.2-patched/y.tab.c 2022-09-23 10:18:27.000000000 -0400
--- y.tab.c 2022-10-14 14:57:26.000000000 -0400
***************
*** 5618,5621 ****
--- 5618,5623 ----
extended_glob = global_extglob;
#endif
+ if (parser_state & (PST_CMDSUBST|PST_STRING))
+ expand_aliases = expaliases_flag;
parser_state = 0;
***************
*** 6700,6703 ****
--- 6702,6706 ----
parser_state |= PST_NOERROR;
+ parser_state |= PST_STRING;
expand_aliases = 0;
***************
*** 8713,8717 ****
parser_state &= ~PST_NOEXPAND; /* parse_comsub sentinel */
/* State flags we want to set for this run through the tokenizer. */
! parser_state |= PST_COMPASSIGN|PST_REPARSE;
}
--- 8716,8720 ----
parser_state &= ~PST_NOEXPAND; /* parse_comsub sentinel */
/* State flags we want to set for this run through the tokenizer. */
! parser_state |= PST_COMPASSIGN|PST_REPARSE|PST_STRING;
}
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 5
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 6
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,262 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-007
Bug-Reported-by: Bruce Jerrick
Bug-Reference-ID:
Bug-Reference-URL: https://bugzilla.redhat.com/show_bug.cgi?id=2134307
Bug-Description:
This patch fixes several problems with alias expansion inside command
substitutions when in POSIX mode.
Patch (apply with `patch -p0'):
*** /fs1/chet/scratch/bash-5.2.6/parse.y 2022-11-02 10:36:54.000000000 -0400
--- parse.y 2022-10-24 10:53:26.000000000 -0400
***************
*** 3613,3616 ****
--- 3614,3618 ----
#define P_ARRAYSUB 0x0020 /* parsing a [...] array subscript for assignment */
#define P_DOLBRACE 0x0040 /* parsing a ${...} construct */
+ #define P_ARITH 0x0080 /* parsing a $(( )) arithmetic expansion */
/* Lexical state while parsing a grouping construct or $(...). */
***************
*** 3911,3914 ****
--- 3914,3920 ----
else if ((flags & (P_ARRAYSUB|P_DOLBRACE)) && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
goto parse_dollar_word;
+ else if ((flags & P_ARITH) && (tflags & LEX_WASDOL) && ch == '(') /*)*/
+ /* $() inside $(( ))/$[ ] */
+ goto parse_dollar_word;
#if defined (PROCESS_SUBSTITUTION)
/* XXX - technically this should only be recognized at the start of
***************
*** 3941,3945 ****
nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|P_DOLBRACE|rflags);
else if (ch == '[') /* ] */
! nestret = parse_matched_pair (0, '[', ']', &nestlen, rflags);
CHECK_NESTRET_ERROR ();
--- 3947,3951 ----
nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|P_DOLBRACE|rflags);
else if (ch == '[') /* ] */
! nestret = parse_matched_pair (0, '[', ']', &nestlen, rflags|P_ARITH);
CHECK_NESTRET_ERROR ();
***************
*** 4080,4084 ****
shell_ungetc (peekc);
if (peekc == '(') /*)*/
! return (parse_matched_pair (qc, open, close, lenp, 0));
}
--- 4086,4090 ----
shell_ungetc (peekc);
if (peekc == '(') /*)*/
! return (parse_matched_pair (qc, open, close, lenp, P_ARITH));
}
***************
*** 4501,4505 ****
exp_lineno = line_number;
! ttok = parse_matched_pair (0, '(', ')', &ttoklen, 0);
rval = 1;
if (ttok == &matched_pair_error)
--- 4512,4516 ----
exp_lineno = line_number;
! ttok = parse_matched_pair (0, '(', ')', &ttoklen, P_ARITH);
rval = 1;
if (ttok == &matched_pair_error)
***************
*** 5016,5020 ****
}
else
! ttok = parse_matched_pair (cd, '[', ']', &ttoklen, 0);
if (ttok == &matched_pair_error)
return -1; /* Bail immediately. */
--- 5030,5034 ----
}
else
! ttok = parse_matched_pair (cd, '[', ']', &ttoklen, P_ARITH);
if (ttok == &matched_pair_error)
return -1; /* Bail immediately. */
*** ../bash-5.2.6/y.tab.c 2022-11-02 10:36:54.000000000 -0400
--- y.tab.c 2022-11-02 10:55:58.000000000 -0400
***************
*** 5924,5927 ****
--- 5924,5928 ----
#define P_ARRAYSUB 0x0020 /* parsing a [...] array subscript for assignment */
#define P_DOLBRACE 0x0040 /* parsing a ${...} construct */
+ #define P_ARITH 0x0080 /* parsing a $(( )) arithmetic expansion */
/* Lexical state while parsing a grouping construct or $(...). */
***************
*** 6222,6225 ****
--- 6223,6229 ----
else if ((flags & (P_ARRAYSUB|P_DOLBRACE)) && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
goto parse_dollar_word;
+ else if ((flags & P_ARITH) && (tflags & LEX_WASDOL) && ch == '(') /*)*/
+ /* $() inside $(( ))/$[ ] */
+ goto parse_dollar_word;
#if defined (PROCESS_SUBSTITUTION)
/* XXX - technically this should only be recognized at the start of
***************
*** 6252,6256 ****
nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|P_DOLBRACE|rflags);
else if (ch == '[') /* ] */
! nestret = parse_matched_pair (0, '[', ']', &nestlen, rflags);
CHECK_NESTRET_ERROR ();
--- 6256,6260 ----
nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|P_DOLBRACE|rflags);
else if (ch == '[') /* ] */
! nestret = parse_matched_pair (0, '[', ']', &nestlen, rflags|P_ARITH);
CHECK_NESTRET_ERROR ();
***************
*** 6391,6395 ****
shell_ungetc (peekc);
if (peekc == '(') /*)*/
! return (parse_matched_pair (qc, open, close, lenp, 0));
}
--- 6395,6399 ----
shell_ungetc (peekc);
if (peekc == '(') /*)*/
! return (parse_matched_pair (qc, open, close, lenp, P_ARITH));
}
***************
*** 6812,6816 ****
exp_lineno = line_number;
! ttok = parse_matched_pair (0, '(', ')', &ttoklen, 0);
rval = 1;
if (ttok == &matched_pair_error)
--- 6816,6820 ----
exp_lineno = line_number;
! ttok = parse_matched_pair (0, '(', ')', &ttoklen, P_ARITH);
rval = 1;
if (ttok == &matched_pair_error)
***************
*** 7327,7331 ****
}
else
! ttok = parse_matched_pair (cd, '[', ']', &ttoklen, 0);
if (ttok == &matched_pair_error)
return -1; /* Bail immediately. */
--- 7331,7335 ----
}
else
! ttok = parse_matched_pair (cd, '[', ']', &ttoklen, P_ARITH);
if (ttok == &matched_pair_error)
return -1; /* Bail immediately. */
*** /fs1/chet/scratch/bash-5.2.6/builtins/evalstring.c 2022-07-18 14:46:56.000000000 -0400
--- builtins/evalstring.c 2022-10-18 10:57:51.000000000 -0400
***************
*** 432,435 ****
--- 432,437 ----
if (parse_command () == 0)
{
+ int local_expalias, local_alflag;
+
if ((flags & SEVAL_PARSEONLY) || (interactive_shell == 0 && read_but_dont_execute))
{
***************
*** 508,511 ****
--- 510,526 ----
#endif /* ONESHOT */
+ /* We play tricks in the parser and command_substitute() turning
+ expand_aliases on and off depending on which parsing pass and
+ whether or not we're in posix mode. This only matters for
+ parsing, and we let the higher layers deal with that. We just
+ want to ensure that expand_aliases is set to the appropriate
+ global value when we go to execute this command, so we save
+ and restore it around the execution (we don't restore it if
+ the global value of the flag (expaliases_flag) changes). */
+ local_expalias = expand_aliases;
+ local_alflag = expaliases_flag;
+ if (subshell_environment & SUBSHELL_COMSUB)
+ expand_aliases = expaliases_flag;
+
/* See if this is a candidate for $( <file ). */
if (startup_state == 2 &&
***************
*** 525,528 ****
--- 540,547 ----
discard_unwind_frame ("pe_dispose");
+ /* If the global value didn't change, we restore what we had. */
+ if ((subshell_environment & SUBSHELL_COMSUB) && local_alflag == expaliases_flag)
+ expand_aliases = local_expalias;
+
if (flags & SEVAL_ONECMD)
{
*** /fs1/chet/scratch/bash-5.2.6/command.h 2021-04-30 15:43:15.000000000 -0400
--- command.h 2022-10-18 11:44:31.000000000 -0400
***************
*** 115,118 ****
--- 115,119 ----
#define PF_EXPANDRHS 0x20 /* same as W_EXPANDRHS */
#define PF_ALLINDS 0x40 /* array, act as if [@] was supplied */
+ #define PF_BACKQUOTE 0x80 /* differentiate `` from $() for command_substitute */
/* Possible values for subshell_environment */
*** /fs1/chet/scratch/bash-5.2.6/subst.c 2022-11-02 10:28:10.000000000 -0400
--- subst.c 2022-10-20 12:41:07.000000000 -0400
***************
*** 7124,7129 ****
/* We want to expand aliases on this pass if we are not in posix mode
! for backwards compatibility. */
! if (expand_aliases)
expand_aliases = posixly_correct == 0;
--- 7133,7142 ----
/* We want to expand aliases on this pass if we are not in posix mode
! for backwards compatibility. parse_and_execute() takes care of
! setting expand_aliases back to the global value when executing the
! parsed string. We only do this for $(...) command substitution,
! since that is what parse_comsub handles; `` comsubs are processed
! using parse.y:parse_matched_pair(). */
! if (expand_aliases && (flags & PF_BACKQUOTE) == 0)
expand_aliases = posixly_correct == 0;
***************
*** 11293,11297 ****
{
de_backslash (temp);
! tword = command_substitute (temp, quoted, 0);
temp1 = tword ? tword->word : (char *)NULL;
if (tword)
--- 11306,11310 ----
{
de_backslash (temp);
! tword = command_substitute (temp, quoted, PF_BACKQUOTE);
temp1 = tword ? tword->word : (char *)NULL;
if (tword)
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 6
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 7
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,58 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-008
Bug-Reported-by: Glenn Jackman <glenn.jackman@gmail.com>
Bug-Reference-ID: <CAFC8ewQDx7hzNJzveuJ5o4FWo=ij7MzckiJVN_6NXjp504QZeg@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00095.html
Bug-Description:
Array subscript expansion can inappropriately quote brackets if the expression
contains < or >.
Patch (apply with `patch -p0'):
*** ../bash-20221015/subst.c 2022-10-18 10:47:33.000000000 -0500
--- subst.c 2022-10-20 11:41:07.000000000 -0500
***************
*** 3820,3823 ****
--- 3820,3827 ----
#endif
+ /* We don't perform process substitution in arithmetic expressions, so don't
+ bother checking for it. */
+ #define ARITH_EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC || s == '~')
+
/* If there are any characters in STRING that require full expansion,
then call FUNC to expand STRING; otherwise just perform quote
***************
*** 4029,4033 ****
while (string[i])
{
! if (EXP_CHAR (string[i]))
break;
else if (string[i] == '\'' || string[i] == '\\' || string[i] == '"')
--- 4033,4037 ----
while (string[i])
{
! if (ARITH_EXP_CHAR (string[i]))
break;
else if (string[i] == '\'' || string[i] == '\\' || string[i] == '"')
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 7
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 8
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,43 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-009
Bug-Reported-by: Corey Hickey <bugfood-ml@fatooh.org>
Bug-Reference-ID: <134330ef-0ead-d73e-68eb-d58fc51efdba@fatooh.org>
Bug-Reference-URL: https://lists.gnu.org/archive/html/help-bash/2022-10/msg00025.html
Bug-Description:
Bash arithmetic expansion should allow `@' and `*' to be used as associative
array keys in expressions.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/expr.c 2022-07-11 10:03:34.000000000 -0400
--- expr.c 2022-10-31 10:51:08.000000000 -0400
***************
*** 1169,1172 ****
--- 1169,1174 ----
#if defined (ARRAY_VARS)
aflag = tflag; /* use a different variable for now */
+ if (shell_compatibility_level > 51)
+ aflag |= AV_ATSTARKEYS;
v = (e == ']') ? array_variable_part (tok, tflag, (char **)0, (int *)0) : find_variable (tok);
#else
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 8
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 9
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,71 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-010
Bug-Reported-by: larsh@apache.org
Bug-Reference-ID:
Bug-Reference-URL: https://savannah.gnu.org/support/?110744
Bug-Description:
Bash-5.2 checks the first 128 characters of an executable file that execve()
refuses to execute to see whether it's a binary file before trying to
execute it as a shell script. This defeats some previously-supported use
cases like "self-executing" jar files or "self-uncompressing" scripts.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/general.c 2022-11-07 10:31:42.000000000 -0500
--- general.c 2022-11-18 14:48:45.000000000 -0500
***************
*** 684,687 ****
--- 684,688 ----
{
register int i;
+ int nline;
unsigned char c;
***************
*** 690,702 ****
/* Generally we check the first line for NULs. If the first line looks like
! a `#!' interpreter specifier, we just look for NULs anywhere in the
! buffer. */
! if (sample[0] == '#' && sample[1] == '!')
! return (memchr (sample, '\0', sample_len) != NULL);
for (i = 0; i < sample_len; i++)
{
c = sample[i];
! if (c == '\n')
return (0);
if (c == '\0')
--- 691,701 ----
/* Generally we check the first line for NULs. If the first line looks like
! a `#!' interpreter specifier, we look for NULs in the first two lines. */
! nline = (sample[0] == '#' && sample[1] == '!') ? 2 : 1;
for (i = 0; i < sample_len; i++)
{
c = sample[i];
! if (c == '\n' && --nline == 0)
return (0);
if (c == '\0')
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 9
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 10
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,45 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-011
Bug-Reported-by: Fabien Orjollet <of1@disroot.org>
Bug-Reference-ID:
Bug-Reference-URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023776
Bug-Description:
Patch (apply with `patch -p0'):
Using timeouts and readline editing with the `read' builtin (read -e -t) can
leave the readline timeout enabled, potentially resulting in an erroneous
timeout on the next call.
*** ../bash-5.2-patched/builtins/read.def 2022-06-02 14:23:19.000000000 -0400
--- builtins/read.def 2022-11-10 10:27:45.000000000 -0500
***************
*** 168,171 ****
--- 168,174 ----
if (read_timeout)
shtimer_clear (read_timeout);
+ #if defined (READLINE)
+ rl_clear_timeout ();
+ #endif
read_timeout = 0;
}
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 10
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 11
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,344 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-012
Bug-Reported-by: Kerin Millar <kfm@plushkava.net>
Bug-Reference-ID: <20221002095107.89561bc811e549b55644df11@plushkava.net>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00001.html
Bug-Description:
When running in bash compatibility mode, nested command substitutions can
leave the `extglob' option enabled.
Patch (apply with `patch -p0'):
*** /fs1/chet/scratch/bash-5.2.12/builtins/shopt.def 2022-11-07 10:31:42.000000000 -0500
--- builtins/shopt.def 2022-10-14 09:30:11.000000000 -0400
***************
*** 150,153 ****
--- 150,158 ----
#endif
+ #if defined (EXTENDED_GLOB)
+ int extglob_flag = EXTGLOB_DEFAULT;
+ static int shopt_set_extglob PARAMS((char *, int));
+ #endif
+
int expaliases_flag = 0;
static int shopt_set_expaliases PARAMS((char *, int));
***************
*** 207,211 ****
#endif
#if defined (EXTENDED_GLOB)
! { "extglob", &extended_glob, (shopt_set_func_t *)NULL },
#endif
{ "extquote", &extended_quote, (shopt_set_func_t *)NULL },
--- 212,216 ----
#endif
#if defined (EXTENDED_GLOB)
! { "extglob", &extglob_flag, shopt_set_extglob },
#endif
{ "extquote", &extended_quote, (shopt_set_func_t *)NULL },
***************
*** 378,382 ****
#if defined (EXTENDED_GLOB)
! extended_glob = EXTGLOB_DEFAULT;
#endif
--- 383,387 ----
#if defined (EXTENDED_GLOB)
! extended_glob = extglob_flag = EXTGLOB_DEFAULT;
#endif
***************
*** 644,647 ****
--- 649,663 ----
}
+ #if defined (EXTENDED_GLOB)
+ static int
+ shopt_set_extglob (option_name, mode)
+ char *option_name;
+ int mode;
+ {
+ extended_glob = extglob_flag;
+ return 0;
+ }
+ #endif
+
#if defined (READLINE)
static int
*** /fs1/chet/scratch/bash-5.2.12/builtins/common.h 2022-11-07 10:31:42.000000000 -0500
--- builtins/common.h 2022-10-14 09:29:25.000000000 -0400
***************
*** 258,261 ****
--- 258,265 ----
#endif
+ #if defined (EXTENDED_GLOB)
+ extern int extglob_flag;
+ #endif
+
extern int expaliases_flag;
*** /fs1/chet/scratch/bash-5.2.12/execute_cmd.c 2022-11-07 10:31:42.000000000 -0500
--- execute_cmd.c 2022-11-02 16:32:12.000000000 -0400
***************
*** 3991,4001 ****
#endif /* COND_REGEXP */
{
- int oe;
- oe = extended_glob;
extended_glob = 1;
result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP|TEST_LOCALE)
? EXECUTION_SUCCESS
: EXECUTION_FAILURE;
! extended_glob = oe;
}
if (arg1 != nullstr)
--- 4015,4023 ----
#endif /* COND_REGEXP */
{
extended_glob = 1;
result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP|TEST_LOCALE)
? EXECUTION_SUCCESS
: EXECUTION_FAILURE;
! extended_glob = extglob_flag;
}
if (arg1 != nullstr)
*** /fs1/chet/scratch/bash-5.2.9/parse.y 2022-11-07 10:31:47.000000000 -0500
--- parse.y 2022-11-14 11:27:22.000000000 -0500
***************
*** 126,130 ****
#if defined (EXTENDED_GLOB)
! extern int extended_glob;
#endif
--- 126,130 ----
#if defined (EXTENDED_GLOB)
! extern int extended_glob, extglob_flag;
#endif
***************
*** 3305,3309 ****
/* Reset to global value of extended glob */
if (parser_state & (PST_EXTPAT|PST_CMDSUBST))
! extended_glob = global_extglob;
#endif
if (parser_state & (PST_CMDSUBST|PST_STRING))
--- 3321,3325 ----
/* Reset to global value of extended glob */
if (parser_state & (PST_EXTPAT|PST_CMDSUBST))
! extended_glob = extglob_flag;
#endif
if (parser_state & (PST_CMDSUBST|PST_STRING))
***************
*** 4125,4132 ****
#if defined (EXTENDED_GLOB)
/* If (parser_state & PST_EXTPAT), we're parsing an extended pattern for a
! conditional command and have already set global_extglob appropriately. */
if (shell_compatibility_level <= 51 && was_extpat == 0)
{
! local_extglob = global_extglob = extended_glob;
extended_glob = 1;
}
--- 4143,4150 ----
#if defined (EXTENDED_GLOB)
/* If (parser_state & PST_EXTPAT), we're parsing an extended pattern for a
! conditional command and have already set extended_glob appropriately. */
if (shell_compatibility_level <= 51 && was_extpat == 0)
{
! local_extglob = extended_glob;
extended_glob = 1;
}
***************
*** 4236,4240 ****
sh_parser_state_t ps;
sh_input_line_state_t ls;
! int orig_ind, nc, sflags, start_lineno;
char *ret, *ep, *ostring;
--- 4256,4260 ----
sh_parser_state_t ps;
sh_input_line_state_t ls;
! int orig_ind, nc, sflags, start_lineno, local_extglob;
char *ret, *ep, *ostring;
***************
*** 4279,4283 ****
expand_aliases = 0;
#if defined (EXTENDED_GLOB)
! global_extglob = extended_glob; /* for reset_parser() */
#endif
--- 4299,4303 ----
expand_aliases = 0;
#if defined (EXTENDED_GLOB)
! local_extglob = extended_glob;
#endif
***************
*** 4297,4300 ****
--- 4317,4323 ----
restore_parser_state (&ps);
+ #if defined (EXTENDED_GLOB)
+ extended_glob = local_extglob;
+ #endif
token_to_read = 0;
***************
*** 4732,4741 ****
--- 4755,4768 ----
/* rhs */
+ #if defined (EXTENDED_GLOB)
local_extglob = extended_glob;
if (parser_state & PST_EXTPAT)
extended_glob = 1;
+ #endif
tok = read_token (READ);
+ #if defined (EXTENDED_GLOB)
if (parser_state & PST_EXTPAT)
extended_glob = local_extglob;
+ #endif
parser_state &= ~(PST_REGEXP|PST_EXTPAT);
***************
*** 4784,4788 ****
COND_COM *cexp;
- global_extglob = extended_glob;
cexp = cond_expr ();
return (make_cond_command (cexp));
--- 4811,4814 ----
*** y.tab.c.save 2022-11-07 10:31:47.000000000 -0500
--- y.tab.c 2022-11-18 15:58:03.000000000 -0500
***************
*** 176,180 ****
#if defined (EXTENDED_GLOB)
! extern int extended_glob;
#endif
--- 176,180 ----
#if defined (EXTENDED_GLOB)
! extern int extended_glob, extglob_flag;
#endif
***************
*** 5616,5620 ****
/* Reset to global value of extended glob */
if (parser_state & (PST_EXTPAT|PST_CMDSUBST))
! extended_glob = global_extglob;
#endif
if (parser_state & (PST_CMDSUBST|PST_STRING))
--- 5616,5620 ----
/* Reset to global value of extended glob */
if (parser_state & (PST_EXTPAT|PST_CMDSUBST))
! extended_glob = extglob_flag;
#endif
if (parser_state & (PST_CMDSUBST|PST_STRING))
***************
*** 6436,6443 ****
#if defined (EXTENDED_GLOB)
/* If (parser_state & PST_EXTPAT), we're parsing an extended pattern for a
! conditional command and have already set global_extglob appropriately. */
if (shell_compatibility_level <= 51 && was_extpat == 0)
{
! local_extglob = global_extglob = extended_glob;
extended_glob = 1;
}
--- 6436,6443 ----
#if defined (EXTENDED_GLOB)
/* If (parser_state & PST_EXTPAT), we're parsing an extended pattern for a
! conditional command and have already set extended_glob appropriately. */
if (shell_compatibility_level <= 51 && was_extpat == 0)
{
! local_extglob = extended_glob;
extended_glob = 1;
}
***************
*** 6547,6551 ****
sh_parser_state_t ps;
sh_input_line_state_t ls;
! int orig_ind, nc, sflags, start_lineno;
char *ret, *ep, *ostring;
--- 6547,6551 ----
sh_parser_state_t ps;
sh_input_line_state_t ls;
! int orig_ind, nc, sflags, start_lineno, local_extglob;
char *ret, *ep, *ostring;
***************
*** 6590,6594 ****
expand_aliases = 0;
#if defined (EXTENDED_GLOB)
! global_extglob = extended_glob; /* for reset_parser() */
#endif
--- 6590,6594 ----
expand_aliases = 0;
#if defined (EXTENDED_GLOB)
! local_extglob = extended_glob;
#endif
***************
*** 6608,6611 ****
--- 6608,6614 ----
restore_parser_state (&ps);
+ #if defined (EXTENDED_GLOB)
+ extended_glob = local_extglob;
+ #endif
token_to_read = 0;
***************
*** 7043,7052 ****
--- 7046,7059 ----
/* rhs */
+ #if defined (EXTENDED_GLOB)
local_extglob = extended_glob;
if (parser_state & PST_EXTPAT)
extended_glob = 1;
+ #endif
tok = read_token (READ);
+ #if defined (EXTENDED_GLOB)
if (parser_state & PST_EXTPAT)
extended_glob = local_extglob;
+ #endif
parser_state &= ~(PST_REGEXP|PST_EXTPAT);
***************
*** 7095,7099 ****
COND_COM *cexp;
- global_extglob = extended_glob;
cexp = cond_expr ();
return (make_cond_command (cexp));
--- 7102,7105 ----
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 11
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 12
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,58 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-013
Bug-Reported-by: Ralf Oehler <Ralf@Oehler-Privat.de>
Bug-Reference-ID: <20221120140252.2fc6489b@bilbo>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00082.html
Bug-Description:
Bash can leak memory when referencing a non-existent associative array
element.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/subst.c 2022-11-05 17:27:48.000000000 -0400
--- subst.c 2022-11-21 14:42:59.000000000 -0500
***************
*** 7498,7503 ****
: quote_escapes (temp);
rflags |= W_ARRAYIND;
- if (estatep)
- *estatep = es; /* structure copy */
}
/* Note that array[*] and array[@] expanded to a quoted null string by
--- 7508,7511 ----
***************
*** 7508,7512 ****
rflags |= W_HASQUOTEDNULL;
! if (estatep == 0)
flush_eltstate (&es);
}
--- 7516,7522 ----
rflags |= W_HASQUOTEDNULL;
! if (estatep)
! *estatep = es; /* structure copy */
! else
flush_eltstate (&es);
}
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 12
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 13
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,119 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-014
Bug-Reported-by: Andreas Schwab <schwab@suse.de>
Bug-Reference-ID: <mvmv8opcbha.fsf@suse.de>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00076.html
Bug-Description:
Bash defers processing additional terminating signals when running the
EXIT trap while exiting due to a terminating signal. This patch allows the
new terminating signal to kill the shell immediately.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/execute_cmd.c 2022-11-23 17:09:18.000000000 -0500
--- execute_cmd.c 2022-11-28 10:36:08.000000000 -0500
***************
*** 3625,3628 ****
--- 3649,3653 ----
dispose_words (es);
+ QUIT;
if (match)
*** ../bash-5.2-patched/sig.c 2021-11-04 14:15:31.000000000 -0400
--- sig.c 2022-12-06 09:45:11.000000000 -0500
***************
*** 95,98 ****
--- 95,99 ----
static void initialize_shell_signals PARAMS((void));
+ static void kill_shell PARAMS((int));
void
***************
*** 487,490 ****
--- 495,500 ----
}
+ static int handling_termsig = 0;
+
sighandler
termsig_sighandler (sig)
***************
*** 533,536 ****
--- 543,554 ----
terminate_immediately = 1;
+ /* If we are currently handling a terminating signal, we have a couple of
+ choices here. We can ignore this second terminating signal and let the
+ shell exit from the first one, or we can exit immediately by killing
+ the shell with this signal. This code implements the latter; to implement
+ the former, replace the kill_shell(sig) with return. */
+ if (handling_termsig)
+ kill_shell (sig); /* just short-circuit now */
+
terminating_signal = sig;
***************
*** 565,572 ****
int sig;
{
- static int handling_termsig = 0;
- int i, core;
- sigset_t mask;
-
/* Simple semaphore to keep this function from being executed multiple
times. Since we no longer are running as a signal handler, we don't
--- 585,588 ----
***************
*** 574,578 ****
if (handling_termsig)
return;
! handling_termsig = 1;
terminating_signal = 0; /* keep macro from re-testing true. */
--- 590,595 ----
if (handling_termsig)
return;
!
! handling_termsig = terminating_signal; /* for termsig_sighandler */
terminating_signal = 0; /* keep macro from re-testing true. */
***************
*** 614,617 ****
--- 631,644 ----
run_exit_trap (); /* XXX - run exit trap possibly in signal context? */
+ kill_shell (sig);
+ }
+
+ static void
+ kill_shell (sig)
+ int sig;
+ {
+ int i, core;
+ sigset_t mask;
+
/* We don't change the set of blocked signals. If a user starts the shell
with a terminating signal blocked, we won't get here (and if by some
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 13
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 14
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,216 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-015
Bug-Reported-by: Frode Nordahl <frode.nordahl@canonical.com>
Bug-Reference-ID: <20221119070714.351759-1-frode.nordahl@canonical.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00078.html
Bug-Description:
There are several cases where bash is too aggressive when optimizing out forks
in subshells. For example, `eval' and traps should never be optimized.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/builtins/common.h 2022-11-23 17:09:18.000000000 -0500
--- builtins/common.h 2022-11-19 18:03:59.000000000 -0500
***************
*** 52,55 ****
--- 52,56 ----
#define SEVAL_ONECMD 0x100 /* only allow a single command */
#define SEVAL_NOHISTEXP 0x200 /* inhibit history expansion */
+ #define SEVAL_NOOPTIMIZE 0x400 /* don't try to set optimization flags */
/* Flags for describe_command, shared between type.def and command.def */
*** ../bash-5.2-patched/builtins/evalstring.c 2022-11-05 17:27:44.000000000 -0400
--- builtins/evalstring.c 2022-11-19 18:23:21.000000000 -0500
***************
*** 133,138 ****
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
(command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) &&
! ((startup_state == 2 && should_suppress_fork (command->value.Connection->second)) ||
! ((subshell_environment & SUBSHELL_PAREN) && should_optimize_fork (command->value.Connection->second, 0))))
{
command->value.Connection->second->flags |= CMD_NO_FORK;
--- 133,138 ----
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
(command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) &&
! (should_suppress_fork (command->value.Connection->second) ||
! ((subshell_environment & SUBSHELL_PAREN) && should_optimize_fork (command->value.Connection->second, 0))))
{
command->value.Connection->second->flags |= CMD_NO_FORK;
***************
*** 291,294 ****
--- 291,295 ----
(flags & SEVAL_RESETLINE) -> reset line_number to 1
(flags & SEVAL_NOHISTEXP) -> history_expansion_inhibited -> 1
+ (flags & SEVAL_NOOPTIMIZE) -> don't try to turn on optimizing flags
*/
***************
*** 503,507 ****
series of connection commands is
command->value.Connection->second. */
! else if (command->type == cm_connection && can_optimize_connection (command))
{
command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING;
--- 504,510 ----
series of connection commands is
command->value.Connection->second. */
! else if (command->type == cm_connection &&
! (flags & SEVAL_NOOPTIMIZE) == 0 &&
! can_optimize_connection (command))
{
command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING;
*** ../bash-5.2-patched/builtins/eval.def 2016-01-25 13:28:37.000000000 -0500
--- builtins/eval.def 2022-11-19 18:04:25.000000000 -0500
***************
*** 54,57 ****
list = loptend; /* skip over possible `--' */
! return (list ? evalstring (string_list (list), "eval", SEVAL_NOHIST) : EXECUTION_SUCCESS);
}
--- 54,57 ----
list = loptend; /* skip over possible `--' */
! return (list ? evalstring (string_list (list), "eval", SEVAL_NOHIST|SEVAL_NOOPTIMIZE) : EXECUTION_SUCCESS);
}
*** ../bash-5.2-patched/trap.c 2022-08-10 08:59:45.000000000 -0400
--- trap.c 2022-12-12 10:57:51.000000000 -0500
***************
*** 305,308 ****
--- 305,309 ----
volatile int save_return_catch_flag, function_code;
procenv_t save_return_catch;
+ char *trap_command, *old_trap;
#if defined (ARRAY_VARS)
ARRAY *ps;
***************
*** 420,423 ****
--- 421,427 ----
else
{
+ old_trap = trap_list[sig];
+ trap_command = savestring (old_trap);
+
save_parser_state (&pstate);
save_subst_varlist = subst_assign_varlist;
***************
*** 442,446 ****
if (function_code == 0)
! x = parse_and_execute (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
else
{
--- 446,451 ----
if (function_code == 0)
! /* XXX is x always last_command_exit_value? */
! x = parse_and_execute (trap_command, "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE|SEVAL_NOOPTIMIZE);
else
{
***************
*** 1003,1007 ****
{
reset_parser ();
! parse_and_execute (trap_command, "exit trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
}
else if (code == ERREXIT)
--- 1008,1012 ----
{
reset_parser ();
! parse_and_execute (trap_command, "exit trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE|SEVAL_NOOPTIMIZE);
}
else if (code == ERREXIT)
***************
*** 1110,1114 ****
}
! flags = SEVAL_NONINT|SEVAL_NOHIST;
if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP)
flags |= SEVAL_RESETLINE;
--- 1115,1119 ----
}
! flags = SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOOPTIMIZE;
if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP)
flags |= SEVAL_RESETLINE;
*** ../bash-5.2-patched/parse.y 2022-11-23 17:09:18.000000000 -0500
--- parse.y 2022-11-19 18:15:34.000000000 -0500
***************
*** 2828,2832 ****
last_lastarg = savestring (last_lastarg);
! parse_and_execute (savestring (command), vname, SEVAL_NONINT|SEVAL_NOHIST);
restore_parser_state (&ps);
--- 2844,2848 ----
last_lastarg = savestring (last_lastarg);
! parse_and_execute (savestring (command), vname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOOPTIMIZE);
restore_parser_state (&ps);
*** ../bash-5.2-patched/jobs.c 2022-07-18 10:19:56.000000000 -0400
--- jobs.c 2022-11-19 18:10:24.000000000 -0500
***************
*** 4221,4225 ****
for (i = 0; i < nchild; i++)
{
! parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST|SEVAL_RESETLINE);
}
--- 4243,4247 ----
for (i = 0; i < nchild; i++)
{
! parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST|SEVAL_RESETLINE|SEVAL_NOOPTIMIZE);
}
*** ../bash-5.2-patched/y.tab.c 2022-11-23 17:09:18.000000000 -0500
--- y.tab.c 2022-11-23 17:21:17.000000000 -0500
***************
*** 5139,5143 ****
last_lastarg = savestring (last_lastarg);
! parse_and_execute (savestring (command), vname, SEVAL_NONINT|SEVAL_NOHIST);
restore_parser_state (&ps);
--- 5154,5158 ----
last_lastarg = savestring (last_lastarg);
! parse_and_execute (savestring (command), vname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOOPTIMIZE);
restore_parser_state (&ps);
*** ../bash-5.2-patched/execute_cmd.c 2022-11-05 17:27:41.000000000 -0400
--- execute_cmd.c 2022-11-22 17:09:38.000000000 -0500
***************
*** 1655,1659 ****
and set CMD_TRY_OPTIMIZING for simple commands on the right side of an
and-or or `;' list to test for optimizing forks when they are executed. */
! if (user_subshell && command->type == cm_subshell)
optimize_subshell_command (command->value.Subshell->command);
--- 1665,1670 ----
and set CMD_TRY_OPTIMIZING for simple commands on the right side of an
and-or or `;' list to test for optimizing forks when they are executed. */
! if (user_subshell && command->type == cm_subshell &&
! (command->flags & (CMD_TIME_PIPELINE|CMD_INVERT_RETURN)) == 0)
optimize_subshell_command (command->value.Subshell->command);
*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 14
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 15
#endif /* _PATCHLEVEL_H_ */
+25 -11
View File
@@ -12,24 +12,31 @@
<IsA>app:console</IsA>
<Summary>The standard GNU Bourne again shell</Summary>
<Description>Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, csh-like features such as history substitution.</Description>
<Archive sha1sum="dc46d863c0410d9252f8fc3d356e47809b4bc46d" type="targz">mirrors://gnu/bash/bash-5.1.16.tar.gz</Archive>
<Archive sha1sum="a799460be16c01aeab492b9aa88f5eb7f35c1b9b" type="targz">mirrors://gnu/bash/bash-5.2.tar.gz</Archive>
<BuildDependencies>
<Dependency>ncurses-devel</Dependency>
</BuildDependencies>
<Patches>
<!-- Official Patches -->
<!-- <Patch>official/bash51-001.patch</Patch>
<Patch>official/bash51-002.patch</Patch>
<Patch>official/bash51-003.patch</Patch>
<Patch>official/bash51-004.patch</Patch>
<Patch>official/bash51-005.patch</Patch>
<Patch>official/bash51-006.patch</Patch>
<Patch>official/bash51-007.patch</Patch>
<Patch>official/bash51-008.patch</Patch>-->
<Patch>official/bash52-001.patch</Patch>
<Patch>official/bash52-002.patch</Patch>
<Patch>official/bash52-003.patch</Patch>
<Patch>official/bash52-004.patch</Patch>
<Patch>official/bash52-005.patch</Patch>
<Patch>official/bash52-006.patch</Patch>
<Patch>official/bash52-007.patch</Patch>
<Patch>official/bash52-008.patch</Patch>
<Patch>official/bash52-009.patch</Patch>
<Patch>official/bash52-010.patch</Patch>
<Patch>official/bash52-011.patch</Patch>
<Patch>official/bash52-012.patch</Patch>
<Patch>official/bash52-013.patch</Patch>
<Patch>official/bash52-014.patch</Patch>
<Patch>official/bash52-015.patch</Patch>
<!-- Fedora patches -->
<Patch level="1">fedora/bash-2.03-paths.patch</Patch>
<!-- <Patch level="1">fedora/bash-2.03-paths.patch</Patch> -->
<Patch level="1">fedora/bash-2.03-profile.patch</Patch>
<Patch level="1">fedora/bash-2.05a-interpreter.patch</Patch>
<Patch level="1">fedora/bash-2.05b-debuginfo.patch</Patch>
@@ -47,7 +54,7 @@
<Patch level="1">fedora/bash-4.3-memleak-lc_all.patch</Patch>
<Patch level="1">fedora/bash-4.3-noecho.patch</Patch>
<Patch level="1">fedora/bash-4.4-no-loadable-builtins.patch</Patch>
<Patch level="1">fedora/bash-infotags.patch</Patch>
<Patch level="1">fedora/bash-5.0-syslog-history.patch</Patch>
<Patch level="1">fedora/bash-requires.patch</Patch>
<Patch level="1">fedora/bash-setlocale.patch</Patch>
<Patch level="1">fedora/bash-tty-tests.patch</Patch>
@@ -76,6 +83,13 @@
</Package>
<History>
<Update release="13">
<Date>2022-12-15</Date>
<Version>5.2.15</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="12">
<Date>2022-05-05</Date>
<Version>5.1.16</Version>
+9 -1
View File
@@ -11,9 +11,10 @@
<IsA>app:web</IsA>
<Summary>Common CA certificates</Summary>
<Description>Common CA certificates</Description>
<Archive sha1sum="c9875aa16e42981c6975e59a11727539053e2299" type="tarxz">http://ftp.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20210119.tar.xz</Archive>
<Archive sha1sum="bce5a8fac45456dbebf256f3a812c6cd0a853e3e" type="tarxz">http://ftp.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20211016.tar.xz</Archive>
<BuildDependencies>
<Dependency>python3</Dependency>
<Dependency>python3-cryptography</Dependency>
</BuildDependencies>
<Patches>
<!--Patch>ca-certificates-undebianize.patch</Patch>
@@ -42,6 +43,13 @@
</Package>
<History>
<Update release="8">
<Date>2022-12-13</Date>
<Version>20211016</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="7">
<Date>2021-10-24</Date>
<Version>20210119</Version>
+3 -2
View File
@@ -13,6 +13,8 @@ def setup():
--sbindir=/sbin \
--libdir=/lib \
--disable-rpath\
--disable-asciidoc \
--disable-ssh-token \
--enable-python")
pisitools.dosed("libtool", " -shared ", " -Wl,-O1,--as-needed -shared ")
@@ -23,5 +25,4 @@ def build():
def install():
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
pisitools.domove("/lib/pkgconfig", "/usr/lib")
pisitools.dodoc("ABOUT-NLS", "AUTHORS", "ChangeLog", "COPYING*",
"FAQ", "README*", "NEWS", "TODO")
pisitools.dodoc("ABOUT-NLS", "AUTHORS", "COPYING*", "README*")
+9 -1
View File
@@ -13,7 +13,7 @@
<IsA>app:cli</IsA>
<Summary>Userspace setup tool for transparent encryption of block devices using dm-crypt</Summary>
<Description>Userspace setup tool for transparent encryption of block devices using dm-crypt</Description>
<Archive sha1sum="004a2c185f8ea45f78b9a171c9b96850081d0ad8" type="tarxz">https://mirrors.edge.kernel.org/pub/linux/utils/cryptsetup/v2.3/cryptsetup-2.3.6.tar.xz</Archive>
<Archive sha1sum="8098a06269c4268b0446b34f7b20e8fa6032e006" type="tarxz">https://mirrors.edge.kernel.org/pub/linux/utils/cryptsetup/v2.6/cryptsetup-2.6.0.tar.xz</Archive>
<BuildDependencies>
<Dependency versionFrom="2.02.186">device-mapper-devel</Dependency>
<Dependency>libgpg-error-devel</Dependency>
@@ -56,6 +56,7 @@
<Dependency>json-c</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/lib/cryptsetup</Path>
<Path fileType="library">/lib/libcryptsetup.so*</Path>
</Files>
</Package>
@@ -87,6 +88,13 @@
</Package>-->
<History>
<Update release="13">
<Date>2022-12-06</Date>
<Version>2.6.0</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="12">
<Date>2022-09-21</Date>
<Version>2.3.6</Version>
+7
View File
@@ -67,6 +67,13 @@
</Package>
<History>
<Update release="22">
<Date>2022-11-25</Date>
<Version>0.112</Version>
<Comment>Rebuild.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="21">
<Date>2022-11-11</Date>
<Version>0.112</Version>
+11
View File
@@ -0,0 +1,11 @@
diff -Nuar a/glib/gthreadprivate.h b/glib/gthreadprivate.h
--- a/glib/gthreadprivate.h 2022-12-22 00:16:58.000000000 +0300
+++ b/glib/gthreadprivate.h 2022-12-22 13:34:01.816585997 +0300
@@ -44,6 +44,7 @@
#include <linux/futex.h>
#include <sys/syscall.h>
#include <unistd.h>
+#include <errno.h>
#ifndef FUTEX_WAIT_PRIVATE
#define FUTEX_WAIT_PRIVATE FUTEX_WAIT
+17 -2
View File
@@ -1,8 +1,8 @@
diff --git i/gio/tests/meson.build w/gio/tests/meson.build
index 65f43e267..3bd66bf60 100644
index 41d4e3e6c..9f8110884 100644
--- i/gio/tests/meson.build
+++ w/gio/tests/meson.build
@@ -598,6 +598,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
@@ -838,6 +838,7 @@ if meson.can_run_host_binaries()
'-r',
'-b','binary',
'@INPUT@',
@@ -10,3 +10,18 @@ index 65f43e267..3bd66bf60 100644
'-o','@OUTPUT@'])
# Rename symbol to match the one in the C file
diff --git i/glib/tests/meson.build w/glib/tests/meson.build
index db01b54b4..42a852b2b 100644
--- i/glib/tests/meson.build
+++ w/glib/tests/meson.build
@@ -126,7 +126,9 @@ glib_tests = {
'thread-pool' : {},
'thread-pool-slow' : {'suite' : ['slow']},
'timeout' : {},
- 'timer' : {},
+ 'timer' : {
+ 'suite' : ['flaky'],
+ },
'tree' : {},
'types' : {},
'utf8-performance' : {},
@@ -1,8 +1,17 @@
diff --git i/gio/glib-compile-schemas.c w/gio/glib-compile-schemas.c
index b8de0907248f6860..130f89b1728f7932 100644
--- i/gio/glib-compile-schemas.c
+++ w/gio/glib-compile-schemas.c
@@ -1219,19 +1219,6 @@ parse_state_start_schema (ParseState *state,
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Fri, 7 Jan 2022 18:59:10 +0000
Subject: [PATCH] glib-compile-schemas: Remove noisy deprecation warnings
---
gio/glib-compile-schemas.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c
index 326658a88b35..f61d45b9a364 100644
--- a/gio/glib-compile-schemas.c
+++ b/gio/glib-compile-schemas.c
@@ -1234,19 +1234,6 @@ parse_state_start_schema (ParseState *state,
return;
}
+16 -1
View File
@@ -12,7 +12,7 @@
<IsA>library</IsA>
<Summary>A library of handy utility functions</Summary>
<Description>glib2 is the low-level core library that forms the basis for projects such as GTK+ and GNOME. It provides data structure handling for C, portability wrappers, and interfaces for such runtime functionality as an event loop, threads, dynamic loading, and an object system.</Description>
<Archive sha1sum="91150e0471ebe3d37ba47f3ce74354812a202a84" type="tarxz">mirrors://gnome/glib/2.74/glib-2.74.1.tar.xz</Archive>
<Archive sha1sum="8d1b033c9144f59330af6d8670bfe55595ecf2db" type="tarxz">mirrors://gnome/glib/2.74/glib-2.74.4.tar.xz</Archive>
<BuildDependencies>
<Dependency>meson</Dependency>
<Dependency>ninja</Dependency>
@@ -27,6 +27,7 @@
<Patches>
<Patch level="1">noisy-glib-compile-schemas.diff</Patch>
<Patch level="1">glib-2.68.2-skip_warnings-1.patch</Patch>
<Patch level="1">glib2.patch</Patch>
</Patches>
<AdditionalFiles>
<AdditionalFile target="multilib.diff" permission="0644">multilib.diff</AdditionalFile>
@@ -140,6 +141,20 @@
</Package>
<History>
<Update release="27">
<Date>2022-12-22</Date>
<Version>2.74.4</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="26">
<Date>2022-11-25</Date>
<Version>2.74.2</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="25">
<Date>2022-10-31</Date>
<Version>2.74.1</Version>
+8 -1
View File
@@ -12,7 +12,7 @@
<IsA>app:console</IsA>
<Summary>GNU utility to convert program --help output to a man page</Summary>
<Description>Help2man is a tool which generate man page from help text of programs.</Description>
<Archive sha1sum="f0fa13494220bfcd902f2e2954ac34a0e3bad47a" type="tarxz">http://ftp.gnu.org/gnu/help2man/help2man-1.47.16.tar.xz</Archive>
<Archive sha1sum="eec547bc2832d47a23437b680232339862d8ca4c" type="tarxz">http://ftp.gnu.org/gnu/help2man/help2man-1.47.3.tar.xz</Archive>
<BuildDependencies>
<Dependency>perl-Locale-gettext</Dependency>
</BuildDependencies>
@@ -37,6 +37,13 @@
</Package>
<History>
<Update release="7">
<Date>2022-12-16</Date>
<Version>1.47.3</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="6">
<Date>2020-12-09</Date>
<Version>1.47.16</Version>
@@ -1,43 +0,0 @@
From e92efc63acd7b377faa9e534f4bf52aaa86be2a9 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 27 Jul 2021 11:46:19 +1000
Subject: [PATCH libX11] makekeys: handle the new _EVDEVK xorgproto symbols
These keys are all defined through a macro in the form:
#define XF86XK_BrightnessAuto _EVDEVK(0x0F4)
The _EVDEVK macro is simply an offset of 0x10081000.
Let's parse these lines correctly so those keysyms end up in our
hashtables.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/util/makekeys.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/util/makekeys.c b/src/util/makekeys.c
index e847ef4c..4896cc53 100644
--- a/src/util/makekeys.c
+++ b/src/util/makekeys.c
@@ -78,6 +78,18 @@ parse_line(const char *buf, char *key, KeySym *val, char *prefix)
return 1;
}
+ /* See if we can parse one of the _EVDEVK symbols */
+ i = sscanf(buf, "#define %127s _EVDEVK(0x%lx)", key, val);
+ if (i == 2 && (tmp = strstr(key, "XK_"))) {
+ memcpy(prefix, key, (size_t)(tmp - key));
+ prefix[tmp - key] = '\0';
+ tmp += 3;
+ memmove(key, tmp, strlen(tmp) + 1);
+
+ *val += 0x10081000;
+ return 1;
+ }
+
/* Now try to catch alias (XK_foo XK_bar) definitions, and resolve them
* immediately: if the target is in the form XF86XK_foo, we need to
* canonicalise this to XF86foo before we do the lookup. */
--
2.31.1
+189
View File
@@ -0,0 +1,189 @@
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index e20c4833c16c6d3518e4b7feb9bdbc606584bfcc..b570bd01c657f4d86f06b414a43e96da4319f729 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -43,6 +43,10 @@ from The Open Group.
#include <X11/Xproto.h> /* to declare xEvent */
#include <X11/XlibConf.h> /* for configured options like XTHREADS */
+#ifdef XTHREADS
+#include <X11/Xthreads.h>
+#endif
+
/* The Xlib structs are full of implicit padding to properly align members.
We can't clean that up without breaking ABI, so tell clang not to bother
complaining about it. */
@@ -207,7 +211,10 @@ struct _XDisplay
XIOErrorExitHandler exit_handler;
void *exit_handler_data;
- CARD32 in_ifevent;
+ CARD32 in_ifevent;
+#ifdef XTHREADS
+ xthread_t ifevent_thread;
+#endif
};
#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
diff --git a/src/ChkIfEv.c b/src/ChkIfEv.c
index b32c2d3ebcb1aad0e704a3e5dce52dc31971afd2..666366966a0e81bf413a64e015a84da1fcf5cdf0 100644
--- a/src/ChkIfEv.c
+++ b/src/ChkIfEv.c
@@ -49,8 +49,11 @@ Bool XCheckIfEvent (
unsigned long qe_serial = 0;
int n; /* time through count */
- dpy->in_ifevent++;
LockDisplay(dpy);
+#ifdef XTHREADS
+ dpy->ifevent_thread = xthread_self();
+#endif
+ dpy->in_ifevent++;
prev = NULL;
for (n = 3; --n >= 0;) {
for (qelt = prev ? prev->next : dpy->head;
diff --git a/src/IfEvent.c b/src/IfEvent.c
index 54c37f0031b27f3d7eb629ec2ea16b615b29e734..35c592e3a54d89f1d2ac1efa40c43a04eab1c0c5 100644
--- a/src/IfEvent.c
+++ b/src/IfEvent.c
@@ -48,8 +48,11 @@ XIfEvent (
register _XQEvent *qelt, *prev;
unsigned long qe_serial = 0;
- dpy->in_ifevent++;
LockDisplay(dpy);
+#ifdef XTHREADS
+ dpy->ifevent_thread = xthread_self();
+#endif
+ dpy->in_ifevent++;
prev = NULL;
while (1) {
for (qelt = prev ? prev->next : dpy->head;
diff --git a/src/PeekIfEv.c b/src/PeekIfEv.c
index 68c028b70705968c6757c1e70a238886a94adecb..754749a77c0835c0ba3c1aa6edded15dab7fb478 100644
--- a/src/PeekIfEv.c
+++ b/src/PeekIfEv.c
@@ -49,8 +49,11 @@ XPeekIfEvent (
register _XQEvent *prev, *qelt;
unsigned long qe_serial = 0;
- dpy->in_ifevent++;
LockDisplay(dpy);
+#ifdef XTHREADS
+ dpy->ifevent_thread = xthread_self();
+#endif
+ dpy->in_ifevent++;
prev = NULL;
while (1) {
for (qelt = prev ? prev->next : dpy->head;
diff --git a/src/locking.c b/src/locking.c
index c550603e1f5d0601af3fa19c0b8486ef5b1bc30f..642cf9894268dfbbb79a104b42b4097cfd293d82 100644
--- a/src/locking.c
+++ b/src/locking.c
@@ -240,7 +240,9 @@ static void _XUnlockDisplay(
if (lock_hist_loc >= LOCK_HIST_SIZE)
lock_hist_loc = 0;
#endif /* XTHREADS_WARN */
- xmutex_unlock(dpy->lock->mutex);
+
+ if (dpy->in_ifevent == 0 || dpy->ifevent_thread != xthread_self())
+ xmutex_unlock(dpy->lock->mutex);
}
@@ -453,63 +455,24 @@ static void _XDisplayLockWait(
}
static void _XLockDisplay(
- Display *dpy
- XTHREADS_FILE_LINE_ARGS
- );
-
-static void _XIfEventLockDisplay(
Display *dpy
XTHREADS_FILE_LINE_ARGS
)
{
- /* assert(dpy->in_ifevent); */
-}
+ struct _XErrorThreadInfo *ti;
-static void _XInternalLockDisplay(
- Display *dpy,
- Bool wskip
- XTHREADS_FILE_LINE_ARGS
- );
+ if (dpy->in_ifevent && dpy->ifevent_thread == xthread_self())
+ return;
-static void _XIfEventInternalLockDisplay(
- Display *dpy,
- Bool wskip
- XTHREADS_FILE_LINE_ARGS
- )
-{
- /* assert(dpy->in_ifevent); */
-}
-
-static void _XIfEventUnlockDisplay(
- Display *dpy
- XTHREADS_FILE_LINE_ARGS
- )
-{
- if (dpy->in_ifevent == 0) {
- dpy->lock_fns->lock_display = _XLockDisplay;
- dpy->lock_fns->unlock_display = _XUnlockDisplay;
- dpy->lock->internal_lock_display = _XInternalLockDisplay;
- UnlockDisplay(dpy);
- } else
- return;
-}
-
-static void _XLockDisplay(
- Display *dpy
- XTHREADS_FILE_LINE_ARGS
- )
-{
-#ifdef XTHREADS
- struct _XErrorThreadInfo *ti;
-#endif
#ifdef XTHREADS_WARN
_XLockDisplayWarn(dpy, file, line);
#else
xmutex_lock(dpy->lock->mutex);
#endif
+
if (dpy->lock->locking_level > 0)
- _XDisplayLockWait(dpy);
-#ifdef XTHREADS
+ _XDisplayLockWait(dpy);
+
/*
* Skip the two function calls below which may generate requests
* when LockDisplay is called from within _XError.
@@ -517,14 +480,9 @@ static void _XLockDisplay(
for (ti = dpy->error_threads; ti; ti = ti->next)
if (ti->error_thread == xthread_self())
return;
-#endif
+
_XIDHandler(dpy);
_XSeqSyncFunction(dpy);
- if (dpy->in_ifevent) {
- dpy->lock_fns->lock_display = _XIfEventLockDisplay;
- dpy->lock_fns->unlock_display = _XIfEventUnlockDisplay;
- dpy->lock->internal_lock_display = _XIfEventInternalLockDisplay;
- }
}
/*
@@ -537,6 +495,9 @@ static void _XInternalLockDisplay(
XTHREADS_FILE_LINE_ARGS
)
{
+ if (dpy->in_ifevent && dpy->ifevent_thread == xthread_self())
+ return;
+
#ifdef XTHREADS_WARN
_XLockDisplayWarn(dpy, file, line);
#else
+32
View File
@@ -0,0 +1,32 @@
diff --git a/src/PutBEvent.c b/src/PutBEvent.c
index f7b74b31deeba41a47816a53bbccf5319810ffb3..b8273e1adca11f6a7cee0199729a0908c2888937 100644
--- a/src/PutBEvent.c
+++ b/src/PutBEvent.c
@@ -85,15 +85,20 @@ XPutBackEvent (
int type = event->type & 0177;
LockDisplay(dpy);
- fp = dpy->wire_vec[type];
- if (fp == NULL)
- fp = _XEventToWire;
- ret = (*fp)(dpy, event, &wire);
- if (ret)
+ if (type == GenericEvent)
+ ret = _XPutBackEvent(dpy, event);
+ else
{
- ret = (*dpy->event_vec[type])(dpy, &lib, &wire);
+ fp = dpy->wire_vec[type];
+ if (fp == NULL)
+ fp = _XEventToWire;
+ ret = (*fp)(dpy, event, &wire);
if (ret)
- ret = _XPutBackEvent(dpy, &lib);
+ {
+ ret = (*dpy->event_vec[type])(dpy, &lib, &wire);
+ if (ret)
+ ret = _XPutBackEvent(dpy, &lib);
+ }
}
UnlockDisplay(dpy);
return ret;
@@ -1,12 +0,0 @@
diff -Naur libX11-1.3.5//src/xlibi18n/ICWrap.c libX11-1.3.5.tpg//src/xlibi18n/ICWrap.c
--- libX11-1.3.5//src/xlibi18n/ICWrap.c 2010-08-10 04:59:44.000000000 +0000
+++ libX11-1.3.5.tpg//src/xlibi18n/ICWrap.c 2010-09-17 17:11:21.000000000 +0000
@@ -283,7 +283,7 @@
XIMArg *args;
char *ret;
- if (!ic->core.im)
+ if (!ic || !ic->core.im)
return (char *) NULL;
/*
@@ -1,50 +0,0 @@
Index: libX11-1.4.99.1/src/Xrm.c
===================================================================
--- libX11-1.4.99.1.orig/src/Xrm.c
+++ libX11-1.4.99.1/src/Xrm.c
@@ -2540,30 +2540,40 @@ Bool XrmQGetResource(
VClosureRec closure;
if (db && *names) {
- _XLockMutex(&db->linfo);
+ if ((_XLockMutex_fn) && db->linfo.lock ) {
+ _XLockMutex(&db->linfo);
+ }
closure.type = pType;
closure.value = pValue;
table = db->table;
if (names[1]) {
if (table && !table->leaf) {
if (GetNEntry(table, names, classes, &closure)) {
- _XUnlockMutex(&db->linfo);
+ if ((_XUnlockMutex_fn) && db->linfo.lock ) {
+ _XUnlockMutex(&db->linfo);
+ }
return True;
}
} else if (table && table->hasloose &&
GetLooseVEntry((LTable)table, names, classes, &closure)) {
- _XUnlockMutex (&db->linfo);
+ if ((_XUnlockMutex_fn) && db->linfo.lock ) {
+ _XUnlockMutex (&db->linfo);
+ }
return True;
}
} else {
if (table && !table->leaf)
table = table->next;
if (table && GetVEntry((LTable)table, names, classes, &closure)) {
- _XUnlockMutex(&db->linfo);
+ if ((_XUnlockMutex_fn) && db->linfo.lock ) {
+ _XUnlockMutex(&db->linfo);
+ }
return True;
}
}
- _XUnlockMutex(&db->linfo);
+ if ((_XUnlockMutex_fn) && db->linfo.lock ) {
+ _XUnlockMutex(&db->linfo);
+ }
}
*pType = NULLQUARK;
pValue->addr = (XPointer)NULL;
-27
View File
@@ -1,27 +0,0 @@
From 5dcb40f28d59587597d2ff6e6ac64c71cfe6ff7b Mon Sep 17 00:00:00 2001
From: James Cloos <cloos@jhcloos.com>
Date: Tue, 17 Sep 2013 16:50:42 +0000
Subject: nls/en_US.UTF-8/Compose.pre: Fix typo.
Fix typo added in 215ce6a67863, s/actute/acute/.
Fixes bug #69476. Reported by Jean Krohn.
Signed-off-by: James Cloos <cloos@jhcloos.com>
---
diff --git a/nls/en_US.UTF-8/Compose.pre b/nls/en_US.UTF-8/Compose.pre
index a741332..7314d7f 100644
--- a/nls/en_US.UTF-8/Compose.pre
+++ b/nls/en_US.UTF-8/Compose.pre
@@ -743,7 +743,7 @@ XCOMM Part 3
<Multi_key> <i> <quotedbl> : "ï" idiaeresis # LATIN SMALL LETTER I WITH DIAERESIS
<Multi_key> <diaeresis> <i> : "ï" idiaeresis # LATIN SMALL LETTER I WITH DIAERESIS
<Multi_key> <i> <diaeresis> : "ï" idiaeresis # LATIN SMALL LETTER I WITH DIAERESIS
-<dead_actute> <j> : "j́" # LATIN SMALL LETTER J U006A with COMBINING ACUTE ACCENT U0301
+<dead_acute> <j> : "j́" # LATIN SMALL LETTER J U006A with COMBINING ACUTE ACCENT U0301
<Multi_key> <apostrophe> <j> : "j́" # LATIN SMALL LETTER J U006A with COMBINING ACUTE ACCENT U0301
<Multi_key> <j> <apostrophe> : "j́" # LATIN SMALL LETTER J U006A with COMBINING ACUTE ACCENT U0301
<Multi_key> <acute> <j> : "j́" # LATIN SMALL LETTER J U006A with COMBINING ACUTE ACCENT U0301
--
cgit v0.9.0.2-2-gbebe
+17 -4
View File
@@ -12,7 +12,7 @@
<IsA>library</IsA>
<Summary>X.Org X11 library</Summary>
<Description>Core X11 protocol client library.</Description>
<Archive sha1sum="608e379a6ac24e1c16eed140d33c35e5fc0b2ed2" type="tarxz">mirrors://xorg/individual/lib/libX11-1.8.2.tar.xz</Archive>
<Archive sha1sum="00f2f25174d2a02cd250e5a0aa9551c79e25e541" type="tarxz">mirrors://xorg/individual/lib/libX11-1.8.3.tar.xz</Archive>
<BuildDependencies>
<Dependency>libxcb-devel</Dependency>
<Dependency>xorg-proto</Dependency>
@@ -22,9 +22,8 @@
<Dependency>xmlto</Dependency>
</BuildDependencies>
<Patches>
<!--<Patch level="1">fix_typo.diff</Patch>
<Patch level="1">fix-segfault.diff</Patch>-->
<!-- <Patch level="1">0001-makekeys-handle-the-new-_EVDEVK-xorgproto-symbols.patch</Patch> -->
<Patch level="1">176.diff</Patch>
<Patch level="1">177.diff</Patch>
</Patches>
</Source>
@@ -76,6 +75,20 @@
</Package>
<History>
<Update release="24">
<Date>2022-12-19</Date>
<Version>1.8.3</Version>
<Comment>Rebuild</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="23">
<Date>2022-12-16</Date>
<Version>1.8.3</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="22">
<Date>2022-11-11</Date>
<Version>1.8.2</Version>
+8 -1
View File
@@ -12,7 +12,7 @@
<IsA>library</IsA>
<Summary>X.Org Au library</Summary>
<Description>libXau provides functions to manage X authorization files</Description>
<Archive sha1sum="fbfef1a4abe2f1d3aa3d8e2252b65f5824627138" type="tarxz">http://xorg.freedesktop.org/archive/individual/lib/libXau-1.0.10.tar.xz</Archive>
<Archive sha1sum="0cf6d853fce4dc72d61c253d096408a313f1163b" type="tarxz">http://xorg.freedesktop.org/archive/individual/lib/libXau-1.0.11.tar.xz</Archive>
<Patches>
<Patch level="1">visibility.patch</Patch>
</Patches>
@@ -61,6 +61,13 @@
</Package>
<History>
<Update release="10">
<Date>2022-12-08</Date>
<Version>1.0.11</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="9">
<Date>2022-09-06</Date>
<Version>1.0.10</Version>
+10 -3
View File
@@ -12,7 +12,7 @@
<IsA>library</IsA>
<Summary>X.Org Xdmcp library</Summary>
<Description>LibXdmcp is the X Display Manager Control Protocol library.</Description>
<Archive sha1sum="0a8f8a274f829331efb1e8e2027c38631b204dd0" type="tarbz2">http://xorg.freedesktop.org/archive/individual/lib/libXdmcp-1.1.3.tar.bz2</Archive>
<Archive sha1sum="38964405cb1e14f57dcaede1fc213155a664b2ab" type="tarxz">http://xorg.freedesktop.org/archive/individual/lib/libXdmcp-1.1.4.tar.xz</Archive>
<BuildDependencies>
<Dependency>libxslt</Dependency>
<Dependency>util-macros</Dependency>
@@ -53,11 +53,11 @@
<Summary>32-bit shared libraries for libXdmcp</Summary>
<BuildType>emul32</BuildType>
<BuildDependencies>
<Dependency>libbsd-32bit</Dependency>
</BuildDependencies>
<RuntimeDependencies>
<Dependency release="current">libXdmcp</Dependency>
<Dependency>libbsd-32bit</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib32</Path>
@@ -65,6 +65,13 @@
</Package>
<History>
<Update release="9">
<Date>2022-11-19</Date>
<Version>1.1.4</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="8">
<Date>2020-12-09</Date>
<Version>1.1.3</Version>
+39 -1
View File
@@ -13,17 +13,40 @@
<IsA>library</IsA>
<Summary>Provides useful functions commonly found on BSD systems</Summary>
<Description>This library provides useful functions commonly found on BSD systems, and lacking on others like GNU systems, thus making it easier to port projects with strong BSD origins, without needing to embed the same code over and over again on each project.</Description>
<Archive sha1sum="9cb8f0b717da13c8aa13b9f3f5f8105ee6e5ccb5" type="tarxz">https://libbsd.freedesktop.org/releases/libbsd-0.10.0.tar.xz</Archive>
<Archive sha1sum="e5f5fffcc2094661a105074c1538f1e434990490" type="tarxz">https://libbsd.freedesktop.org/releases/libbsd-0.11.7.tar.xz</Archive>
<BuildDependencies>
<Dependency>libmd-devel</Dependency>
</BuildDependencies>
</Source>
<Package>
<Name>libbsd</Name>
<RuntimeDependencies>
<Dependency>libmd</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib</Path>
<Path fileType="doc">/usr/share/doc</Path>
</Files>
</Package>
<Package>
<Name>libbsd-32bit</Name>
<PartOf>emul32</PartOf>
<Summary>32-bit shared libraries for libbsd</Summary>
<BuildType>emul32</BuildType>
<BuildDependencies>
<Dependency>libmd-32bit</Dependency>
</BuildDependencies>
<RuntimeDependencies>
<Dependency>libmd-32bit</Dependency>
<Dependency release="current">libbsd</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib32</Path>
</Files>
</Package>
<Package>
<Name>libbsd-devel</Name>
<Summary>Development files for libbsd</Summary>
@@ -33,12 +56,27 @@
<Files>
<Path fileType="header">/usr/include</Path>
<Path fileType="data">/usr/lib/pkgconfig</Path>
<Path fileType="data">/usr/lib32/pkgconfig</Path>
<Path fileType="man">/usr/share/man/man3</Path>
<Path fileType="man">/usr/share/man/man7</Path>
</Files>
</Package>
<History>
<Update release="9">
<Date>2022-12-04</Date>
<Version>0.11.7</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="8">
<Date>2022-11-22</Date>
<Version>0.10.0</Version>
<Comment>Rebuild.</Comment>
<Name>Pisi Linux Community</Name>
<Email>admin@pisilinux.org</Email>
</Update>
<Update release="7">
<Date>2020-12-09</Date>
<Version>0.10.0</Version>
+8 -1
View File
@@ -13,7 +13,7 @@
<IsA>library</IsA>
<Summary>Library for error values used by GnuPG components</Summary>
<Description>libgpg-error is a library that defines common error values for all GnuPG components.</Description>
<Archive sha1sum="5e620d71fc24d287a7ac2460b1d819074bb8b9bb" type="tarbz2">https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.42.tar.bz2</Archive>
<Archive sha1sum="a6e5efdd72e848aab4064e5ef4c6835ba344bcf1" type="tarbz2">https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.46.tar.bz2</Archive>
</Source>
<Package>
@@ -61,6 +61,13 @@
</Package>
<History>
<Update release="11">
<Date>2022-12-20</Date>
<Version>1.46</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="10">
<Date>2021-05-28</Date>
<Version>1.42</Version>
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get
def setup():
autotools.configure(" --enable-static=no")
def build():
autotools.make()
def install():
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
pisitools.dodoc("ChangeLog", "COPYING", "README*")
+71
View File
@@ -0,0 +1,71 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>libmd</Name>
<Homepage>https://www.hadrons.org/software/libmd/</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>BSD</License>
<IsA>library</IsA>
<Summary>Message Digest functions from BSD systems</Summary>
<Icon>libmd</Icon>
<Description>Message Digest functions from BSD systems</Description>
<Archive sha1sum="c412a6cb3792e00927127b85cb99b46f493eecce" type="tarxz">https://libbsd.freedesktop.org/releases/libmd-1.0.4.tar.xz</Archive>
<!--
<Patches>
<Patch>libmd.patch</Patch>
<Patch level="1">libmd.patch</Patch>
</Patches>
-->
</Source>
<Package>
<Name>libmd</Name>
<Files>
<Path fileType="library">/usr/lib</Path>
<Path fileType="data">/usr/share</Path>
<Path fileType="localedata">/usr/share/locale</Path>
<Path fileType="man">/usr/share/man</Path>
<Path fileType="doc">/usr/share/doc</Path>
</Files>
</Package>
<Package>
<Name>libmd-32bit</Name>
<PartOf>emul32</PartOf>
<Summary>32-bit shared libraries for libmd</Summary>
<BuildType>emul32</BuildType>
<RuntimeDependencies>
<Dependency release="current">libmd</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib32</Path>
</Files>
</Package>
<Package>
<Name>libmd-devel</Name>
<Summary>Development files for libmd</Summary>
<RuntimeDependencies>
<Dependency release="current">libmd</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="header">/usr/include</Path>
<Path fileType="library">/usr/lib/pkgconfig</Path>
<Path fileType="library">/usr/lib32/pkgconfig</Path>
</Files>
</Package>
<History>
<Update release="1">
<Date>2022-12-04</Date>
<Version>1.0.4</Version>
<Comment>First release</Comment>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Update>
</History>
</PISI>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>libmd</Name>
<Summary xml:lang="tr">Message Digest functions from BSD systems</Summary>
<Description xml:lang="tr">Message Digest functions from BSD systems</Description>
</Source>
</PISI>
+1 -1
View File
@@ -19,4 +19,4 @@ def build():
def install():
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
pisitools.dodoc("AUTHORS", "ChangeLog", "COPYING", "NEWS", "README")
pisitools.dodoc("AUTHORS", "COPYING", "NEWS", "README")
+8 -1
View File
@@ -12,7 +12,7 @@
<IsA>library</IsA>
<Summary>Public client interface library for NIS(YP) and NIS+</Summary>
<Description>Public client interface library for NIS(YP) and NIS+</Description>
<Archive sha1sum="f141c7cf0ff96d96e369dda36af8ed19af0fc3ca" type="targz">https://github.com/thkukuk/libnsl/archive/v1.2.0/libnsl-1.2.0.tar.gz</Archive>
<Archive sha1sum="f727e4e0bbf233a2367465bcbaed546ab4875744" type="targz">https://github.com/thkukuk/libnsl/archive/v2.0.0/libnsl-2.0.0.tar.gz</Archive>
<BuildDependencies>
<Dependency>libtirpc-devel</Dependency>
</BuildDependencies>
@@ -44,6 +44,13 @@
</Package>
<History>
<Update release="5">
<Date>2022-12-31</Date>
<Version>2.0.0</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="4">
<Date>2022-09-28</Date>
<Version>1.2.0</Version>
+8 -1
View File
@@ -12,7 +12,7 @@
<IsA>library</IsA>
<Summary>Perl-compatible regular expression library</Summary>
<Description>The PCRE (Perl Compatible Regular Expressions) library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.</Description>
<Archive sha1sum="5a433f92b29083d0d8ccd4ec56e3afbe1fa09863" type="tarbz2">https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.bz2</Archive>
<Archive sha1sum="ea443ae87a4f5ab925a69cb3090605998061faed" type="tarbz2">https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.41/pcre2-10.41.tar.bz2</Archive>
<BuildDependencies>
<Dependency>readline-devel</Dependency>
</BuildDependencies>
@@ -71,6 +71,13 @@
</Package>
<History>
<Update release="6">
<Date>2022-12-07</Date>
<Version>10.41</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="5">
<Date>2022-08-23</Date>
<Version>10.40</Version>
+8 -1
View File
@@ -12,7 +12,7 @@
<IsA>library</IsA>
<Summary>Transport Independent RPC library</Summary>
<Description>Transport Independent RPC library</Description>
<Archive sha1sum="51d75be0e5acc094a888f40042b23e128d163cb5" type="tarbz2">https://sourceforge.net/projects/libtirpc/files/libtirpc/1.3.2/libtirpc-1.3.2.tar.bz2</Archive>
<Archive sha1sum="6e52c39148494e4836e2d5d4f28b11ddfa65394b" type="tarbz2">https://sourceforge.net/projects/libtirpc/files/libtirpc/1.3.3/libtirpc-1.3.3.tar.bz2</Archive>
<BuildDependencies>
<Dependency>mit-kerberos-devel</Dependency>
<Dependency>e2fsprogs-devel</Dependency>
@@ -49,6 +49,13 @@
</Package>
<History>
<Update release="7">
<Date>2022-12-04</Date>
<Version>1.3.3</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="6">
<Date>2022-09-28</Date>
<Version>1.3.2</Version>
+8 -1
View File
@@ -13,7 +13,7 @@
<IsA>app:console</IsA>
<Summary>MIT Kerberos Library</Summary>
<Description>Kerberos is a network authentication protocol. It is designed to provide strong authentication for client/server applications by using secret-key cryptography.</Description>
<Archive sha1sum="e6addc23e361798b9f1243e6809620449d7fcb38" type="targz">http://web.mit.edu/kerberos/dist/krb5/1.20/krb5-1.20.tar.gz</Archive>
<Archive sha1sum="06278439a6cd5a2aa861d8e877451b794487534b" type="targz">https://kerberos.org/dist/krb5/1.20/krb5-1.20.1.tar.gz</Archive>
<BuildDependencies>
<Dependency>python3</Dependency>
<Dependency>keyutils</Dependency>
@@ -76,6 +76,13 @@
</Package>
<History>
<Update release="10">
<Date>2022-12-06</Date>
<Version>1.20.1</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="9">
<Date>2022-09-26</Date>
<Version>1.20</Version>
+9 -1
View File
@@ -19,8 +19,9 @@
<AdditionalFile target="dlopen-test.sh" permission="0755">dlopen-test.sh</AdditionalFile-->
</AdditionalFiles>
<BuildDependencies>
<Dependency>libnsl-devel</Dependency>
<Dependency versionFrom="2.0.0">libnsl-devel</Dependency>
<Dependency>audit-devel</Dependency>
<Dependency>libtirpc-devel</Dependency>
</BuildDependencies>
<!--Patches>
<Patch level="1">CVE-2020-27780.patch</Patch>
@@ -69,6 +70,13 @@
</Package>
<History>
<Update release="12">
<Date>2022-12-31</Date>
<Version>1.5.2</Version>
<Comment>Rebuild.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="11">
<Date>2022-09-28</Date>
<Version>1.5.2</Version>
@@ -0,0 +1,49 @@
diff --git a/lib/test_process.c b/lib/test_process.c
index e20b270d..f8ff5ed0 100644
--- a/lib/test_process.c
+++ b/lib/test_process.c
@@ -69,6 +69,7 @@ signal_handler(int signum, siginfo_t *siginfo, void *ucontext)
exit(EXIT_FAILURE);
}
+ free(signame);
}
int main(int argc, char *argv[])
diff --git a/pmap.c b/pmap.c
index 49a2a6a8..d8565fc3 100644
--- a/pmap.c
+++ b/pmap.c
@@ -346,6 +346,9 @@ static void print_extended_maps (FILE *f)
if (listnode == NULL) {
assert(firstmapping == 2);
listnode = calloc(1, sizeof *listnode);
+ if (listnode == NULL)
+ xerrx(EXIT_FAILURE, _("ERROR: memory allocation failed"));
+
if (listhead == NULL) {
assert(listtail == NULL);
listhead = listnode;
diff --git a/watch.c b/watch.c
index 1a95454e..772879cd 100644
--- a/watch.c
+++ b/watch.c
@@ -124,8 +124,6 @@ static void reset_ansi(void)
static void init_ansi_colors(void)
{
- int color;
-
short ncurses_colors[] = {
-1, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
@@ -172,6 +170,9 @@ static int process_ansi_color_escape_sequence(char** escape_sequence) {
// ESC[ 48;2;⟨r⟩;⟨g⟩;⟨b⟩ m Select RGB background color
int num;
+ if (!escape_sequence)
+ return 0; /* avoid NULLPTR dereference, return "not understood" */
+
if ((*escape_sequence)[0] != ';')
return 0; /* not understood */
@@ -0,0 +1,12 @@
diff -up ./free.c.ori ./free.c
--- ./free.c.ori 2022-09-20 15:02:22.469320938 +0200
+++ ./free.c 2022-09-20 15:03:33.767710892 +0200
@@ -120,7 +120,7 @@ static const char *scale_size(unsigned l
/* default output */
if (args.exponent == 0 && !(flags & FREE_HUMANREADABLE)) {
- snprintf(buf, sizeof(buf), "%ld", size);
+ snprintf(buf, sizeof(buf), "%ld", (long)( ((long long int)size) * 1024 / (long long int)base));
return buf;
}
@@ -0,0 +1,286 @@
From 52afb3a8d31871d28b1c39573a7ed5196c2d5023 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Mon, 15 Feb 2021 21:10:06 +1100
Subject: [PATCH] pidwait: Rename from pwait
pwait is already in at least Debian in a different package
References:
https://bugs.debian.org/982391
---
diff --git a/Makefile.am b/Makefile.am
index e037e4c..de15e13 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,8 +49,8 @@ bin_PROGRAMS = \
uptime \
vmstat \
w
-if BUILD_PWAIT
-bin_PROGRAMS += pwait
+if BUILD_PIDWAIT
+bin_PROGRAMS += pidwait
endif
else
usrbin_exec_PROGRAMS += \
@@ -85,8 +85,8 @@ dist_man_MANS += \
sysctl.conf.5 \
ps/ps.1
-if BUILD_PWAIT
-dist_man_MANS += pwait.1
+if BUILD_PIDWAIT
+dist_man_MANS += pidwait.1
endif
endif
@@ -199,8 +199,8 @@ free_SOURCES = free.c lib/strutils.c lib/fileutils.c
pgrep_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
pkill_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
pmap_SOURCES = pmap.c lib/fileutils.c
-if BUILD_PWAIT
-pwait_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
+if BUILD_PIDWAIT
+pidwait_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
endif
if !CYGWIN
pwdx_SOURCES = pwdx.c lib/fileutils.c
diff --git a/NEWS b/NEWS
index da63c9c..5fe6761 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+procps-ng-NEXT
+---------------
+ * Rename pwait to pidwait
+
procps-ng-3.3.17
---------------
* library: Incremented to 8:3:0
diff --git a/configure.ac b/configure.ac
index 56a8669..750c0fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,20 +132,20 @@ AC_TRY_COMPILE([#include <errno.h>],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
-AC_CHECK_FUNC([pidfd_open], [enable_pwait=yes], [
+AC_CHECK_FUNC([pidfd_open], [enable_pidwait=yes], [
AC_MSG_CHECKING([for __NR_pidfd_open])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <sys/syscall.h>
#ifndef __NR_pidfd_open
#error __NR_pidfd_open not defined
#endif
- ])], [enable_pwait=yes], [enable_pwait=no])
- AC_MSG_RESULT([$enable_pwait])
+ ])], [enable_pidwait=yes], [enable_pidwait=no])
+ AC_MSG_RESULT([$enable_pidwait])
])
-if test "$enable_pwait" = yes; then
- AC_DEFINE([ENABLE_PWAIT], [1], [Enable pwait])
+if test "$enable_pidwait" = yes; then
+ AC_DEFINE([ENABLE_PIDWAIT], [1], [Enable pidwait])
fi
-AM_CONDITIONAL([BUILD_PWAIT], [test x$enable_pwait = xyes])
+AM_CONDITIONAL([BUILD_PIDWAIT], [test x$enable_pidwait = xyes])
dnl watch8bit must be before the AC_ARG_WITH set as it sets up ncurses
AC_SUBST([WITH_WATCH8BIT])
diff --git a/pgrep.1 b/pgrep.1
index 4f8907b..af6dcd5 100644
--- a/pgrep.1
+++ b/pgrep.1
@@ -9,7 +9,7 @@
.\"
.TH PGREP "1" "2020-06-04" "procps-ng" "User Commands"
.SH NAME
-pgrep, pkill, pwait \- look up, signal, or wait for processes based on name and other attributes
+pgrep, pkill, pidwait \- look up, signal, or wait for processes based on name and other attributes
.SH SYNOPSIS
.B pgrep
[options] pattern
@@ -17,7 +17,7 @@ pgrep, pkill, pwait \- look up, signal, or wait for processes based on name and
.B pkill
[options] pattern
.br
-.B pwait
+.B pidwait
[options] pattern
.SH DESCRIPTION
.B pgrep
@@ -45,7 +45,7 @@ will send the specified signal (by default
.BR SIGTERM )
to each process instead of listing them on stdout.
.PP
-.B pwait
+.B pidwait
will wait for each process instead of listing them on stdout.
.SH OPTIONS
.TP
@@ -60,7 +60,7 @@ only.)
\fB\-c\fR, \fB\-\-count\fR
Suppress normal output; instead print a count of matching processes. When
count does not match anything, e.g. returns zero, the command will return
-non-zero value. Note that for pkill and pwait, the count is the number of
+non-zero value. Note that for pkill and pidwait, the count is the number of
matching processes, not the processes that were successfully signaled or waited
for.
.TP
@@ -88,7 +88,7 @@ translated into
.BR pgrep 's,
.BR pkill 's,
or
-.BR pwait 's
+.BR pidwait 's
own process group.
.TP
\fB\-G\fR, \fB\-\-group\fR \fIgid\fP,...
@@ -126,7 +126,7 @@ is translated into
.BR pgrep 's,
.BR pkill 's,
or
-.BR pwait 's
+.BR pidwait 's
own session ID.
.TP
\fB\-t\fR, \fB\-\-terminal\fR \fIterm\fP,...
@@ -145,7 +145,7 @@ symbolical value may be used.
Negates the matching. This option is usually used in
.BR pgrep 's
or
-.BR pwait 's
+.BR pidwait 's
context. In
.BR pkill 's
context the short option is disabled to avoid accidental usage of the option.
@@ -154,7 +154,7 @@ context the short option is disabled to avoid accidental usage of the option.
Shows all thread ids instead of pids in
.BR pgrep 's
or
-.BR pwait 's
+.BR pidwait 's
context. In
.BR pkill 's
context this option is disabled.
@@ -167,7 +167,7 @@ match the
.TP
\fB\-F\fR, \fB\-\-pidfile\fR \fIfile\fR
Read \fIPID\fRs from \fIfile\fR. This option is more useful for
-.BR pkill or pwait
+.BR pkill or pidwait
than
.BR pgrep .
.TP
@@ -237,7 +237,7 @@ $ renice +4 $(pgrep chrome)
.PD 0
.TP
0
-One or more processes matched the criteria. For pkill and pwait, one or more
+One or more processes matched the criteria. For pkill and pidwait, one or more
processes must also have been successfully signalled or waited for.
.TP
1
@@ -258,7 +258,7 @@ The running
.BR pgrep ,
.BR pkill ,
or
-.B pwait
+.B pidwait
process will never report itself as a
match.
.SH BUGS
diff --git a/pgrep.c b/pgrep.c
index 4fe5e8a..1905cd1 100644
--- a/pgrep.c
+++ b/pgrep.c
@@ -38,7 +38,7 @@
#include <stdbool.h>
#include <time.h>
-#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN)
+#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN)
#include <sys/epoll.h>
#include <sys/syscall.h>
#endif
@@ -68,8 +68,8 @@
static enum {
PGREP = 0,
PKILL,
-#ifdef ENABLE_PWAIT
- PWAIT,
+#ifdef ENABLE_PIDWAIT
+ PIDWAIT,
#endif
} prog_mode;
@@ -136,8 +136,8 @@ static int __attribute__ ((__noreturn__)) usage(int opt)
fputs(_(" -q, --queue <value> integer value to be sent with the signal\n"), fp);
fputs(_(" -e, --echo display what is killed\n"), fp);
break;
-#ifdef ENABLE_PWAIT
- case PWAIT:
+#ifdef ENABLE_PIDWAIT
+ case PIDWAIT:
fputs(_(" -e, --echo display PIDs before waiting\n"), fp);
break;
#endif
@@ -687,7 +687,7 @@ static struct el * select_procs (int *num)
xerrx(EXIT_FAILURE, _("internal error"));
}
- // pkill and pwait don't support -w, but this is checked in getopt
+ // pkill and pidwait don't support -w, but this is checked in getopt
if (opt_threads) {
while (readtask(ptp, &task, &subtask)){
// don't add redundant tasks
@@ -742,7 +742,7 @@ static int signal_option(int *argc, char **argv)
return -1;
}
-#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN)
+#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN)
static int pidfd_open (pid_t pid, unsigned int flags)
{
return syscall(__NR_pidfd_open, pid, flags);
@@ -793,9 +793,9 @@ static void parse_opts (int argc, char **argv)
{NULL, 0, NULL, 0}
};
-#ifdef ENABLE_PWAIT
- if (strcmp (program_invocation_short_name, "pwait") == 0) {
- prog_mode = PWAIT;
+#ifdef ENABLE_PIDWAIT
+ if (strcmp (program_invocation_short_name, "pidwait") == 0) {
+ prog_mode = PIDWAIT;
strcat (opts, "e");
} else
#endif
@@ -1008,7 +1008,7 @@ int main (int argc, char **argv)
int num;
int i;
int kill_count = 0;
-#ifdef ENABLE_PWAIT
+#ifdef ENABLE_PIDWAIT
int poll_count = 0;
int wait_count = 0;
int epollfd = epoll_create(1);
@@ -1055,8 +1055,8 @@ int main (int argc, char **argv)
fprintf(stdout, "%d\n", num);
return !kill_count;
-#ifdef ENABLE_PWAIT
- case PWAIT:
+#ifdef ENABLE_PIDWAIT
+ case PIDWAIT:
if (opt_count)
fprintf(stdout, "%d\n", num);
diff --git a/pwait.1 b/pidwait.1
similarity index 100%
rename from pwait.1
rename to pidwait.1
--
GitLab
@@ -0,0 +1,833 @@
diff -up ./NEWS.ori ./NEWS
diff -up ./sysctl.c.ori ./sysctl.c
--- ./sysctl.c.ori 2021-02-09 11:11:25.000000000 +0100
+++ ./sysctl.c 2022-03-31 18:27:36.536486629 +0200
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Part of this code comes from systemd, especially sysctl.c
* Changelog:
* v1.01:
* - added -p <preload> to preload values from a file
@@ -40,6 +41,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <ctype.h>
#include "c.h"
#include "fileutils.h"
@@ -66,12 +68,34 @@ static bool PrintName;
static bool PrintNewline;
static bool IgnoreError;
static bool Quiet;
+static bool DryRun;
static char *pattern;
#define LINELEN 4096
static char *iobuf;
static size_t iolen = LINELEN;
+typedef struct SysctlSetting {
+ char *key;
+ char *path;
+ char *value;
+ bool ignore_failure;
+ bool glob_exclude;
+ struct SysctlSetting *next;
+} SysctlSetting;
+
+typedef struct SettingList {
+ struct SysctlSetting *head;
+ struct SysctlSetting *tail;
+} SettingList;
+
+#define GLOB_CHARS "*?["
+static inline bool string_is_glob(const char *p)
+{
+ return !!strpbrk(p, GLOB_CHARS);
+}
+
+
/* Function prototypes. */
static int pattern_match(const char *string, const char *pat);
static int DisplayAll(const char *restrict const path);
@@ -100,6 +124,81 @@ static void slashdot(char *restrict p, c
}
}
+static void setting_free(SysctlSetting *s) {
+ if (!s)
+ return;
+
+ free(s->key);
+ free(s->path);
+ free(s->value);
+ free(s);
+}
+
+static SysctlSetting *setting_new(
+ const char *key,
+ const char *value,
+ bool ignore_failure,
+ bool glob_exclude) {
+
+ SysctlSetting *s = NULL;
+ char *path = NULL;
+ int proc_len;
+
+ proc_len = strlen(PROC_PATH);
+ /* used to open the file */
+ path = xmalloc(strlen(key) + proc_len + 2);
+ strcpy(path, PROC_PATH);
+ if (key[0] == '-')
+ strcat(path + proc_len, key+1);
+ else
+ strcat(path + proc_len, key);
+ /* change . to / */
+ slashdot(path + proc_len, '.', '/');
+
+ s = xmalloc(sizeof(SysctlSetting));
+
+ *s = (SysctlSetting) {
+ .key = strdup(key),
+ .path = path,
+ .value = value? strdup(value): NULL,
+ .ignore_failure = ignore_failure,
+ .glob_exclude = glob_exclude,
+ .next = NULL,
+ };
+
+ return s;
+}
+
+static void settinglist_add(SettingList *l, SysctlSetting *s) {
+ SysctlSetting *old_tail;
+
+ if (!l)
+ return;
+
+ if (l->head == NULL)
+ l->head = s;
+
+ if (l->tail != NULL) {
+ old_tail = l->tail;
+ old_tail->next = s;
+ }
+ l->tail = s;
+}
+
+static SysctlSetting *settinglist_findpath(const SettingList *l, const char *path) {
+ SysctlSetting *node;
+
+ for (node=l->head; node != NULL; node = node->next) {
+ if (strcmp(node->path, path) == 0)
+ return node;
+ }
+ return NULL;
+}
+
+/* Function prototypes. */
+static int pattern_match(const char *string, const char *pat);
+static int DisplayAll(const char *restrict const path);
+
/*
* Display the usage format
*/
@@ -115,6 +214,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -A alias of -a\n"), out);
fputs(_(" -X alias of -a\n"), out);
fputs(_(" --deprecated include deprecated parameters to listing\n"), out);
+ fputs(_(" --dry-run Print the key and values but do not write\n"), out);
fputs(_(" -b, --binary print value without new line\n"), out);
fputs(_(" -e, --ignore ignore unknown variables errors\n"), out);
fputs(_(" -N, --names print variable names without values\n"), out);
@@ -138,6 +238,39 @@ static void __attribute__ ((__noreturn__
}
/*
+ * Strip left/leading side of a string
+ */
+static char *lstrip(char *line)
+{
+ char *start;
+
+ if (!line || !*line)
+ return line;
+
+ start = line;
+ while(isspace(*start)) start++;
+
+ return start;
+}
+
+/*
+ * Strip right/trailing side of a string
+ * by placing a \0
+ */
+static void rstrip(char *line)
+{
+ char *end;
+
+ if (!line || !*line)
+ return;
+
+ end = line + strlen(line) - 1;
+ while(end > line && isspace(*end)) end--;
+
+ end[1] = '\0';
+}
+
+/*
* Strip the leading and trailing spaces from a string
*/
static char *StripLeadingAndTrailingSpaces(char *oneline)
@@ -166,7 +299,7 @@ static char *StripLeadingAndTrailingSpac
*/
static int ReadSetting(const char *restrict const name)
{
- int rc = 0;
+ int rc = EXIT_SUCCESS;
char *restrict tmpname;
char *restrict outname;
ssize_t rlen;
@@ -198,7 +331,7 @@ static int ReadSetting(const char *restr
if (stat(tmpname, &ts) < 0) {
if (!IgnoreError) {
xwarn(_("cannot stat %s"), tmpname);
- rc = -1;
+ rc = EXIT_FAILURE;
}
goto out;
}
@@ -215,7 +348,7 @@ static int ReadSetting(const char *restr
}
if (pattern && !pattern_match(outname, pattern)) {
- rc = 0;
+ rc = EXIT_SUCCESS;
goto out;
}
@@ -231,19 +364,19 @@ static int ReadSetting(const char *restr
case ENOENT:
if (!IgnoreError) {
xwarnx(_("\"%s\" is an unknown key"), outname);
- rc = -1;
+ rc = EXIT_FAILURE;
}
break;
case EACCES:
xwarnx(_("permission denied on key '%s'"), outname);
- rc = -1;
+ rc = EXIT_FAILURE;
break;
case EIO: /* Ignore stable_secret below /proc/sys/net/ipv6/conf */
- rc = -1;
+ rc = EXIT_FAILURE;
break;
default:
xwarn(_("reading key \"%s\""), outname);
- rc = -1;
+ rc = EXIT_FAILURE;
break;
}
} else {
@@ -279,7 +412,7 @@ static int ReadSetting(const char *restr
case EACCES:
xwarnx(_("permission denied on key '%s'"),
outname);
- rc = -1;
+ rc = EXIT_FAILURE;
break;
case EISDIR: {
size_t len;
@@ -291,11 +424,11 @@ static int ReadSetting(const char *restr
goto out;
}
case EIO: /* Ignore stable_secret below /proc/sys/net/ipv6/conf */
- rc = -1;
+ rc = EXIT_FAILURE;
break;
default:
xwarnx(_("reading key \"%s\""), outname);
- rc = -1;
+ rc = EXIT_FAILURE;
case 0:
break;
}
@@ -323,7 +456,7 @@ static int is_deprecated(char *filename)
*/
static int DisplayAll(const char *restrict const path)
{
- int rc = 0;
+ int rc = EXIT_SUCCESS;
int rc2;
DIR *restrict dp;
struct dirent *restrict de;
@@ -333,7 +466,7 @@ static int DisplayAll(const char *restri
if (!dp) {
xwarnx(_("unable to open directory \"%s\""), path);
- rc = -1;
+ rc = EXIT_FAILURE;
} else {
readdir(dp); /* skip . */
readdir(dp); /* skip .. */
@@ -369,130 +502,183 @@ static int DisplayAll(const char *restri
/*
* Write a sysctl setting
*/
-static int WriteSetting(const char *setting)
-{
- int rc = 0;
- const char *name = setting;
- const char *value;
- const char *equals;
- char *tmpname;
- char *outname;
- char *last_dot;
- bool ignore_failure;
+static int WriteSetting(
+ const char *key,
+ const char *path,
+ const char *value,
+ const bool ignore_failure) {
- FILE *fp;
+ int rc = EXIT_SUCCESS;
+ FILE *fp;
struct stat ts;
- if (!name)
- /* probably don't want to display this err */
- return 0;
-
- equals = strchr(setting, '=');
-
- if (!equals) {
- xwarnx(_("\"%s\" must be of the form name=value"),
- setting);
- return -1;
- }
-
- /* point to the value in name=value */
- value = equals + 1;
-
- if (!*name || name == equals) {
- xwarnx(_("malformed setting \"%s\""), setting);
- return -2;
- }
-
- ignore_failure = name[0] == '-';
- if (ignore_failure)
- name++;
+ if (!key || !path)
+ return rc;
- /* used to open the file */
- tmpname = xmalloc(equals - name + 1 + strlen(PROC_PATH));
- strcpy(tmpname, PROC_PATH);
- strncat(tmpname, name, (int) (equals - name));
- tmpname[equals - name + strlen(PROC_PATH)] = 0;
- /* change . to / */
- slashdot(tmpname + strlen(PROC_PATH), '.', '/');
-
- /* used to display the output */
- outname = xmalloc(equals - name + 1);
- strncpy(outname, name, (int) (equals - name));
- outname[equals - name] = 0;
- /* change / to . */
- slashdot(outname, '/', '.');
- last_dot = strrchr(outname, '.');
- if (last_dot != NULL && is_deprecated(last_dot + 1)) {
- xwarnx(_("%s is deprecated, value not set"), outname);
- goto out;
- }
-
- if (stat(tmpname, &ts) < 0) {
+ if (stat(path, &ts) < 0) {
if (!IgnoreError) {
- xwarn(_("cannot stat %s"), tmpname);
- rc = -1;
+ xwarn(_("cannot stat %s"), path);
+ rc = EXIT_FAILURE;
}
- goto out;
+ return rc;
}
if ((ts.st_mode & S_IWUSR) == 0) {
- xwarn(_("setting key \"%s\""), outname);
- goto out;
+ xwarn(_("setting key \"%s\""), key);
+ return rc;
}
if (S_ISDIR(ts.st_mode)) {
- xwarn(_("setting key \"%s\""), outname);
- goto out;
+ xwarn(_("setting key \"%s\""), key);
+ return rc;
}
- fp = fprocopen(tmpname, "w");
-
- if (!fp) {
- switch (errno) {
- case ENOENT:
- if (!IgnoreError) {
- xwarnx(_("\"%s\" is an unknown key%s"), outname, (ignore_failure?_(", ignoring"):""));
+ if (!DryRun) {
+ if ((fp = fprocopen(path, "w")) == NULL) {
+ switch (errno) {
+ case ENOENT:
+ if (!IgnoreError) {
+ xwarnx(_("\"%s\" is an unknown key%s"),
+ key, (ignore_failure?_(", ignoring"):""));
if (!ignore_failure)
- rc = -1;
+ rc = EXIT_FAILURE;
}
break;
- case EPERM:
- case EROFS:
- case EACCES:
- xwarnx(_("permission denied on key \"%s\"%s"), outname, (ignore_failure?_(", ignoring"):""));
- break;
- default:
- xwarn(_("setting key \"%s\"%s"), outname, (ignore_failure?_(", ignoring"):""));
- break;
- }
- if (!ignore_failure && errno != ENOENT)
- rc = -1;
- } else {
- rc = fprintf(fp, "%s\n", value);
- if (0 < rc)
- rc = 0;
- if (close_stream(fp) != 0)
- xwarn(_("setting key \"%s\""), outname);
- else if (rc == 0 && !Quiet) {
- if (NameOnly) {
- fprintf(stdout, "%s\n", outname);
- } else {
- if (PrintName) {
- fprintf(stdout, "%s = %s\n",
- outname, value);
- } else {
- if (PrintNewline)
- fprintf(stdout, "%s\n", value);
- else
- fprintf(stdout, "%s", value);
- }
- }
- }
- }
- out:
- free(tmpname);
- free(outname);
- return rc;
+ case EPERM:
+ case EROFS:
+ case EACCES:
+ xwarnx(_("permission denied on key \"%s\"%s"),
+ key, (ignore_failure?_(", ignoring"):""));
+ break;
+ default:
+ xwarn(_("setting key \"%s\"%s"),
+ key, (ignore_failure?_(", ignoring"):""));
+ break;
+ }
+ if (!ignore_failure && errno != ENOENT)
+ rc = EXIT_FAILURE;
+ } else {
+ if (0 < fprintf(fp, "%s\n", value))
+ rc = EXIT_SUCCESS;
+ if (close_stream(fp) != 0) {
+ xwarn(_("setting key \"%s\""), path);
+ return rc;
+ }
+ }
+ }
+ if ((rc == EXIT_SUCCESS && !Quiet) || DryRun) {
+ if (NameOnly) {
+ printf("%s\n", value);
+ } else {
+ if (PrintName) {
+ printf("%s = %s\n", path, value);
+ } else {
+ if (PrintNewline)
+ printf("%s\n", value);
+ else
+ printf("%s", value);
+ }
+ }
+ }
+ return rc;
+}
+
+/*
+ * parse each configuration line, there are multiple ways of specifying
+ * a key/value here:
+ *
+ * key = value simple setting
+ * -key = value ignore errors
+ * key.pattern.*.with.glob = value set keys that match glob
+ * -key.pattern.exclude.with.glob dont set this value
+ * key.pattern.override.with.glob = value set this glob match to value
+ *
+ */
+
+static SysctlSetting *parse_setting_line(
+ const char *path,
+ const int linenum,
+ char *line)
+{
+ SysctlSetting *s;
+ char *key;
+ char *value;
+ bool glob_exclude = FALSE;
+ bool ignore_failure = FALSE;
+
+ key = lstrip(line);
+ if (strlen(key) < 2)
+ return NULL;
+
+ /* skip over comments */
+ if (key[0] == '#' || key[0] == ';')
+ return NULL;
+
+ if (pattern && !pattern_match(key, pattern))
+ return NULL;
+
+ value = strchr(key, '=');
+ if (value == NULL) {
+ if (key[0] == '-') {
+ glob_exclude = TRUE;
+ key++;
+ value = NULL;
+ rstrip(key);
+ } else {
+ xwarnx(_("%s(%d): invalid syntax, continuing..."),
+ path, linenum);
+ return NULL;
+ }
+ } else {
+ value[0]='\0';
+ if (key[0] == '-') {
+ ignore_failure = TRUE;
+ key++;
+ }
+ value++; // skip over =
+ value=lstrip(value);
+ rstrip(value);
+ rstrip(key);
+ }
+ return setting_new(key, value, ignore_failure, glob_exclude);
+}
+
+/* Go through the setting list, expand and sort out
+ * setting globs and actually write the settings out
+ */
+static int write_setting_list(const SettingList *sl)
+{
+ SysctlSetting *node;
+ int rc = EXIT_SUCCESS;
+
+ for (node=sl->head; node != NULL; node=node->next) {
+ if (node->glob_exclude)
+ continue;
+
+ if (string_is_glob(node->path)) {
+ char *gl_path;
+ glob_t globbuf;
+ int i;
+
+ if (glob(node->path, 0, NULL, &globbuf) != 0)
+ continue;
+
+ for(i=0; i < globbuf.gl_pathc; i++) {
+ if (settinglist_findpath(sl, globbuf.gl_pathv[i]))
+ continue; // override or exclude
+
+ rc |= WriteSetting(node->key, globbuf.gl_pathv[i], node->value,
+ node->ignore_failure);
+ }
+ } else {
+ rc |= WriteSetting(node->key, node->path, node->value,
+ node->ignore_failure);
+ }
+
+
+ }
+
+ return rc;
}
static int pattern_match(const char *string, const char *pat)
@@ -513,12 +699,12 @@ static int pattern_match(const char *str
* Preload the sysctl's from the conf file. We parse the file and then
* reform it (strip out whitespace).
*/
-static int Preload(const char *restrict const filename)
+static int Preload(SettingList *setlist, const char *restrict const filename)
{
FILE *fp;
char *t;
int n = 0;
- int rc = 0;
+ int rc = EXIT_SUCCESS;
ssize_t rlen;
char *name, *value;
glob_t globbuf;
@@ -547,62 +733,26 @@ static int Preload(const char *restrict
? stdin : fopen(globbuf.gl_pathv[j], "r");
if (!fp) {
xwarn(_("cannot open \"%s\""), globbuf.gl_pathv[j]);
- rc = -1;
- goto out;
+ return EXIT_FAILURE;
}
while ((rlen = getline(&iobuf, &iolen, fp)) > 0) {
size_t offset;
+ SysctlSetting *setting;
n++;
if (rlen < 2)
continue;
- t = StripLeadingAndTrailingSpaces(iobuf);
- if (strlen(t) < 2)
- continue;
-
- if (*t == '#' || *t == ';')
- continue;
-
- name = strtok(t, "=");
- if (!name || !*name) {
- xwarnx(_("%s(%d): invalid syntax, continuing..."),
- globbuf.gl_pathv[j], n);
- continue;
- }
-
- StripLeadingAndTrailingSpaces(name);
-
- if (pattern && !pattern_match(name, pattern))
- continue;
-
- offset = strlen(name);
- memmove(&iobuf[0], name, offset);
- iobuf[offset++] = '=';
-
- value = strtok(NULL, "\n\r");
- if (!value || !*value) {
- xwarnx(_("%s(%d): invalid syntax, continuing..."),
- globbuf.gl_pathv[j], n);
- continue;
- }
-
- while ((*value == ' ' || *value == '\t') && *value != 0)
- value++;
-
- /* should NameOnly affect this? */
- memmove(&iobuf[offset], value, strlen(value));
- offset += strlen(value);
- iobuf[offset] = '\0';
-
- rc |= WriteSetting(iobuf);
+ if ( (setting = parse_setting_line(globbuf.gl_pathv[j], n, iobuf))
+ == NULL)
+ continue;
+ settinglist_add(setlist, setting);
}
fclose(fp);
}
-out:
return rc;
}
@@ -618,7 +768,7 @@ static int sortpairs(const void *A, cons
return strcmp(a->name, b->name);
}
-static int PreloadSystem(void)
+static int PreloadSystem(SettingList *setlist)
{
unsigned di, i;
const char *dirs[] = {
@@ -630,7 +780,7 @@ static int PreloadSystem(void)
};
struct pair **cfgs = NULL;
unsigned ncfgs = 0;
- int rc = 0;
+ int rc = EXIT_SUCCESS;
struct stat ts;
enum { nprealloc = 16 };
@@ -688,14 +838,14 @@ static int PreloadSystem(void)
for (i = 0; i < ncfgs; ++i) {
if (!Quiet)
printf(_("* Applying %s ...\n"), cfgs[i]->value);
- rc |= Preload(cfgs[i]->value);
+ rc |= Preload(setlist, cfgs[i]->value);
}
if (stat(DEFAULT_PRELOAD, &ts) == 0 && S_ISREG(ts.st_mode)) {
if (!Quiet)
printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD);
- rc |= Preload(DEFAULT_PRELOAD);
+ rc |= Preload(setlist, DEFAULT_PRELOAD);
}
/* cleaning */
@@ -717,15 +867,19 @@ int main(int argc, char *argv[])
bool preloadfileOpt = false;
int ReturnCode = 0;
int c;
+ int rc;
const char *preloadfile = NULL;
+ SettingList *setlist;
enum {
DEPRECATED_OPTION = CHAR_MAX + 1,
- SYSTEM_OPTION
+ SYSTEM_OPTION,
+ DRYRUN_OPTION
};
static const struct option longopts[] = {
{"all", no_argument, NULL, 'a'},
{"deprecated", no_argument, NULL, DEPRECATED_OPTION},
+ {"dry-run", no_argument, NULL, DRYRUN_OPTION},
{"binary", no_argument, NULL, 'b'},
{"ignore", no_argument, NULL, 'e'},
{"names", no_argument, NULL, 'N'},
@@ -753,6 +907,10 @@ int main(int argc, char *argv[])
IgnoreError = false;
Quiet = false;
IgnoreDeprecated = true;
+ DryRun = false;
+ setlist = xmalloc(sizeof(SettingList));
+ setlist->head = NULL;
+ setlist->tail = NULL;
if (argc < 2)
Usage(stderr);
@@ -805,7 +963,12 @@ int main(int argc, char *argv[])
break;
case SYSTEM_OPTION:
IgnoreError = true;
- return PreloadSystem();
+ rc |= PreloadSystem(setlist);
+ rc |= write_setting_list(setlist);
+ return rc;
+ case DRYRUN_OPTION:
+ DryRun = true;
+ break;
case 'r':
pattern = xstrdup(optarg);
break;
@@ -833,15 +996,16 @@ int main(int argc, char *argv[])
int ret = EXIT_SUCCESS, i;
if (!preloadfile) {
if (!argc) {
- ret |= Preload(DEFAULT_PRELOAD);
+ ret |= Preload(setlist, DEFAULT_PRELOAD);
}
} else {
/* This happens when -pfile option is
* used without space. */
- ret |= Preload(preloadfile);
+ ret |= Preload(setlist, preloadfile);
}
for (i = 0; i < argc; i++)
- ret |= Preload(argv[i]);
+ ret |= Preload(setlist, argv[i]);
+ ret |= write_setting_list(setlist);
return ret;
}
@@ -855,9 +1019,14 @@ int main(int argc, char *argv[])
program_invocation_short_name);
for ( ; *argv; argv++) {
- if (WriteMode || strchr(*argv, '='))
- ReturnCode += WriteSetting(*argv);
- else
+ if (WriteMode || strchr(*argv, '=')) {
+ SysctlSetting *s;
+ if ( (s = parse_setting_line("command line", 0, *argv)) != NULL)
+ ReturnCode |= WriteSetting(s->key, s->path, s->value,
+ s->ignore_failure);
+ else
+ ReturnCode |= EXIT_FAILURE;
+ } else
ReturnCode += ReadSetting(*argv);
}
return ReturnCode;
diff -up ./testsuite/config/unix.exp.ori ./testsuite/config/unix.exp
--- ./testsuite/config/unix.exp.ori 2021-02-09 11:11:25.000000000 +0100
+++ ./testsuite/config/unix.exp 2022-03-31 18:27:36.536486629 +0200
@@ -136,6 +136,15 @@ proc expect_table_dsc { test match_heade
#}
}
+proc expect_spawn_retval { test retval } {
+ foreach {pid spawnid os_error_flag value} [wait] break
+
+ if {$value == $retval} {
+ return
+ }
+ fail "$test (exit value)"
+}
+
proc make_pipeproc { } {
global pipeproc_pid pipeproc_spawnid topdir
diff -up ./testsuite/sysctl_glob_test.conf.ori ./testsuite/sysctl_glob_test.conf
--- ./testsuite/sysctl_glob_test.conf.ori 2022-03-31 18:27:36.537486635 +0200
+++ ./testsuite/sysctl_glob_test.conf 2022-03-31 18:27:36.537486635 +0200
@@ -0,0 +1,6 @@
+#
+# Test configuration for for glob in sysctl
+#
+fs.protected_* = 2
+fs.protected_hardlinks = 1
+-fs.protected_regular
diff -up ./testsuite/sysctl.test/sysctl_write.exp.ori ./testsuite/sysctl.test/sysctl_write.exp
--- ./testsuite/sysctl.test/sysctl_write.exp.ori 2022-03-31 18:27:36.536486629 +0200
+++ ./testsuite/sysctl.test/sysctl_write.exp 2022-03-31 18:27:36.536486629 +0200
@@ -0,0 +1,29 @@
+
+set sysctl ${topdir}sysctl
+
+set test "sysctl write from command line"
+spawn $sysctl --dry-run kernel.hostname=procps-test
+expect_pass "$test" "/proc/sys/kernel/hostname = procps-test"
+
+set test "sysctl write from configuration file"
+spawn $sysctl --dry-run -f ${topdir}testsuite/sysctl_glob_test.conf
+expect_pass "$test" "/proc/sys/fs/protected_fifos = 2\\s+/proc/sys/fs/protected_symlinks = 2\\s+/proc/sys/fs/protected_hardlinks = 1"
+
+set hostname_file "/proc/sys/kernel/hostname"
+if {[file exists ${hostname_file}]} {
+ if {[file writable ${hostname_file}]} {
+ unsupported "sysctl write: hostname file is writable"
+ } else {
+ set test "sysctl write unwritable file"
+ spawn $sysctl -q kernel.hostname=procpstest
+ expect_pass "$test" "sysctl: permission denied on key \"kernel.hostname\"\\s*$"
+ expect_spawn_retval "$test" 1
+
+ set test "sysctl write unwritable file ignored"
+ spawn $sysctl -q -- -kernel.hostname=procpstest
+ expect_pass "$test" "sysctl: permission denied on key \"kernel.hostname\", ignoring\\s*$"
+ expect_spawn_retval "$test" 0
+ }
+} else {
+ unsupported "sysctl write: hostname file doe not exist"
+}
@@ -0,0 +1,153 @@
diff -up ./NEWS.ori ./NEWS
--- ./NEWS.ori 2022-08-15 11:59:35.929714848 +0200
+++ ./NEWS 2022-08-15 12:00:12.892937479 +0200
@@ -1,4 +1,14 @@
procps-ng-NEXT
+<<<<<<< HEAD
+=======
+ * library
+ Re-add elogind support merge #151
+ * ps: threads again display when -L is used with -q issue #234
+ * ps: proper aix format string behavior was restored
+ * sysctl: print dotted keys again
+
+procps-ng-4.0.0
+>>>>>>> b159c198 (sysctl: print dotted keys again)
---------------
* Rename pwait to pidwait
diff -up ./sysctl.c.ori ./sysctl.c
--- ./sysctl.c.ori 2022-08-15 11:59:35.934714878 +0200
+++ ./sysctl.c 2022-08-15 12:00:12.893937485 +0200
@@ -152,7 +152,7 @@ static SysctlSetting *setting_new(
strcat(path + proc_len, key+1);
else
strcat(path + proc_len, key);
- /* change . to / */
+ /* change . to / for path */
slashdot(path + proc_len, '.', '/');
s = xmalloc(sizeof(SysctlSetting));
@@ -510,7 +510,8 @@ static int WriteSetting(
int rc = EXIT_SUCCESS;
FILE *fp;
- struct stat ts;
+ struct stat ts;
+ char *dotted_key;
if (!key || !path)
return rc;
@@ -523,13 +524,22 @@ static int WriteSetting(
return rc;
}
- if ((ts.st_mode & S_IWUSR) == 0) {
- xwarn(_("setting key \"%s\""), key);
+ /* Convert the globbed path into a dotted key */
+ if ( (dotted_key = strdup(path + strlen(PROC_PATH))) == NULL) {
+ xerrx(EXIT_FAILURE, _("strdup key"));
+ return EXIT_FAILURE;
+ }
+ slashdot(dotted_key, '/', '.');
+
+ if ((ts.st_mode & S_IWUSR) == 0) {
+ xwarn(_("setting key \"%s\""), dotted_key);
+ free(dotted_key);
return rc;
}
- if (S_ISDIR(ts.st_mode)) {
- xwarn(_("setting key \"%s\""), key);
+ if (S_ISDIR(ts.st_mode)) {
+ xwarn(_("setting key \"%s\""), dotted_key);
+ free(dotted_key);
return rc;
}
@@ -539,7 +549,7 @@ static int WriteSetting(
case ENOENT:
if (!IgnoreError) {
xwarnx(_("\"%s\" is an unknown key%s"),
- key, (ignore_failure?_(", ignoring"):""));
+ dotted_key, (ignore_failure?_(", ignoring"):""));
if (!ignore_failure)
rc = EXIT_FAILURE;
}
@@ -548,11 +558,11 @@ static int WriteSetting(
case EROFS:
case EACCES:
xwarnx(_("permission denied on key \"%s\"%s"),
- key, (ignore_failure?_(", ignoring"):""));
+ dotted_key, (ignore_failure?_(", ignoring"):""));
break;
default:
xwarn(_("setting key \"%s\"%s"),
- key, (ignore_failure?_(", ignoring"):""));
+ dotted_key, (ignore_failure?_(", ignoring"):""));
break;
}
if (!ignore_failure && errno != ENOENT)
@@ -561,7 +571,7 @@ static int WriteSetting(
if (0 < fprintf(fp, "%s\n", value))
rc = EXIT_SUCCESS;
if (close_stream(fp) != 0) {
- xwarn(_("setting key \"%s\""), path);
+ xwarn(_("setting key \"%s\""), dotted_key);
return rc;
}
}
@@ -571,7 +581,7 @@ static int WriteSetting(
printf("%s\n", value);
} else {
if (PrintName) {
- printf("%s = %s\n", path, value);
+ printf("%s = %s\n", dotted_key, value);
} else {
if (PrintNewline)
printf("%s\n", value);
@@ -580,6 +590,7 @@ static int WriteSetting(
}
}
}
+ free(dotted_key);
return rc;
}
diff -up ./testsuite/sysctl_slash_test.conf.ori ./testsuite/sysctl_slash_test.conf
--- ./testsuite/sysctl_slash_test.conf.ori 2022-08-15 12:00:12.894937491 +0200
+++ ./testsuite/sysctl_slash_test.conf 2022-08-15 12:00:12.893937485 +0200
@@ -0,0 +1 @@
+kernel/hostname = procps-test
diff -up ./testsuite/sysctl.test/sysctl_write.exp.ori ./testsuite/sysctl.test/sysctl_write.exp
--- ./testsuite/sysctl.test/sysctl_write.exp.ori 2022-08-15 11:59:35.934714878 +0200
+++ ./testsuite/sysctl.test/sysctl_write.exp 2022-08-15 12:00:12.893937485 +0200
@@ -3,11 +3,19 @@ set sysctl ${topdir}sysctl
set test "sysctl write from command line"
spawn $sysctl --dry-run kernel.hostname=procps-test
-expect_pass "$test" "/proc/sys/kernel/hostname = procps-test"
+expect_pass "$test" "kernel.hostname = procps-test"
+
+set test "sysctl write from command line using slash"
+spawn $sysctl --dry-run kernel/hostname=procps-test
+expect_pass "$test" "kernel.hostname = procps-test"
set test "sysctl write from configuration file"
spawn $sysctl --dry-run -f ${topdir}testsuite/sysctl_glob_test.conf
-expect_pass "$test" "/proc/sys/fs/protected_fifos = 2\\s+/proc/sys/fs/protected_symlinks = 2\\s+/proc/sys/fs/protected_hardlinks = 1"
+expect_pass "$test" "fs.protected_fifos = 2\\s+fs.protected_symlinks = 2\\s+fs.protected_hardlinks = 1"
+
+set test "sysctl write from file with slashes"
+spawn $sysctl --dry-run -f ${topdir}testsuite/sysctl_slash_test.conf
+expect_pass "$test" "kernel.hostname = procps-test"
set hostname_file "/proc/sys/kernel/hostname"
if {[file exists ${hostname_file}]} {
@@ -25,5 +33,5 @@ if {[file exists ${hostname_file}]} {
expect_spawn_retval "$test" 0
}
} else {
- unsupported "sysctl write: hostname file doe not exist"
+ unsupported "sysctl write: hostname file does not exist"
}
-60
View File
@@ -1,60 +0,0 @@
From bb96fc42956c9ed926a1b958ab715f8b4a663dec Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Sun, 5 Jan 2020 15:05:55 +1100
Subject: [PATCH] pgrep: check sanity of SC_ARG_MAX
A kernel change means we cannot trust what sysconf(SC_ARG_MAX)
returns. We clamp it so its more than 4096 and less than 128*1024
which is what findutils does.
References:
procps-ng/procps#152
https://git.savannah.gnu.org/cgit/findutils.git/tree/lib/buildcmd.c#n535
https://lwn.net/Articles/727862/
---
pgrep.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/pgrep.c b/pgrep.c
index 01563db..bde7448 100644
--- a/pgrep.c
+++ b/pgrep.c
@@ -485,6 +485,26 @@ static regex_t * do_regcomp (void)
return preg;
}
+/*
+ * SC_ARG_MAX used to return the maximum size a command line can be
+ * however changes to the kernel mean this can be bigger than we can
+ * alloc. Clamp it to 128kB like xargs and friends do
+ * Should also not be smaller than POSIX_ARG_MAX which is 4096
+ */
+static size_t get_arg_max(void)
+{
+#define MIN_ARG_SIZE 4096u
+#define MAX_ARG_SIZE (128u * 1024u)
+
+ size_t val = sysconf(_SC_ARG_MAX);
+
+ if (val < MIN_ARG_SIZE)
+ val = MIN_ARG_SIZE;
+ if (val > MAX_ARG_SIZE)
+ val = MAX_ARG_SIZE;
+
+ return val;
+}
static struct el * select_procs (int *num)
{
PROCTAB *ptp;
@@ -497,7 +517,7 @@ static struct el * select_procs (int *num)
regex_t *preg;
pid_t myself = getpid();
struct el *list = NULL;
- long cmdlen = sysconf(_SC_ARG_MAX) * sizeof(char);
+ long cmdlen = get_arg_max() * sizeof(char);
char *cmdline = xmalloc(cmdlen);
char *cmdsearch = xmalloc(cmdlen);
char *cmdoutput = xmalloc(cmdlen);
--
2.26.2
-10
View File
@@ -1,10 +0,0 @@
--- procps-3.2.7~/top.c 2006-06-25 08:41:48.000000000 +0200
+++ procps-3.2.7/top.c 2007-07-20 12:50:00.000000000 +0200
@@ -2886,6 +2886,7 @@
s_frme = cpu->s - cpu->s_sav;
n_frme = cpu->n - cpu->n_sav;
i_frme = TRIMz(cpu->i - cpu->i_sav);
+ if ((u_frme == 0) && (i_frme == 0)) i_frme = 100.0;
w_frme = cpu->w - cpu->w_sav;
x_frme = cpu->x - cpu->x_sav;
y_frme = cpu->y - cpu->y_sav;
@@ -1,10 +0,0 @@
--- procps-3.2.5/top.h
+++ procps-3.2.5/top.h
@@ -132,6 +132,7 @@
#define _PUFF(fmt,arg...) \
do { \
char _str[ROWBUFSIZ]; \
+ if (Pseudo_row >= Screen_rows-1) break; \
int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \
putp ( Batch ? _str : \
({ \
@@ -1,19 +0,0 @@
--- procps-3.2.5/w.c
+++ procps-3.2.5/w.c
@@ -285,10 +285,16 @@
if (ioctl(1, TIOCGWINSZ, &win) != -1 && win.ws_col > 0)
maxcmd = win.ws_col;
+#if 0
+/* I have no idea why I shouldn't be allowed to see the result
+ with a line wrap. The other solution would be to create a
+ wcat alias, which does w|cat to work around this, but this
+ would be stupid in my opinion. */
if (maxcmd < 71) {
fprintf(stderr, "%d column window is too narrow\n", maxcmd);
exit(1);
}
+#endif
maxcmd -= 29 + (from ? 16 : 0) + (longform ? 20 : 0);
if (maxcmd < 3)
fprintf(stderr, "warning: screen width %d suboptimal.\n", win.ws_col);
@@ -1,11 +0,0 @@
--- procps-3.2.5/top.c
+++ procps-3.2.5/top.c
@@ -3285,7 +3285,7 @@
if (rc <= 0) {
// EOF is pretty much a "can't happen" except for a kernel bug.
// We should quickly die via SIGHUP, and thus not spin here.
- // if (rc == 0) end_pgm(0); /* EOF from terminal */
+ if (rc == 0) end_pgm(0); /* EOF from terminal */
fcntl(STDIN_FILENO, F_SETFL, file_flags);
select(1, &fs, NULL, NULL, &tv);
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags);
@@ -1,6 +0,0 @@
--- a/proc/readproc.c
+++ b/proc/readproc.c
@@ -858,2 +858,2 @@
if(file2str("/proc/self", "stat", sbuf, sizeof sbuf) == -1){
- fprintf(stderr, "Error, do this: mount -t proc none /proc\n");
+ fprintf(stderr, "Error, do this: mount -t proc proc /proc\n");
@@ -1,28 +0,0 @@
diff -up procps-3.2.7/proc/escape.c.p8 procps-3.2.7/proc/escape.c
--- procps-3.2.7/proc/escape.c.p8 2005-01-05 21:50:26.000000000 +0100
+++ procps-3.2.7/proc/escape.c 2008-09-01 11:31:15.000000000 +0200
@@ -79,6 +79,7 @@ static int escape_str_utf8(char *restric
// multibyte - printable
// Got space?
if (my_cells+wlen > *maxcells || my_bytes+1+len >= bufsize) break;
+#ifdef OUTPUT_PARANOID
// 0x9b is control byte for some terminals
if (memchr(src, 0x9B, len)) {
// unsafe multibyte
@@ -87,13 +88,16 @@ static int escape_str_utf8(char *restric
my_cells++;
my_bytes++;
} else {
+#endif
// safe multibyte
memcpy(dst, src, len);
my_cells += wlen;
dst += len;
my_bytes += len;
src += len;
+#ifdef OUTPUT_PARANOID
}
+#endif
}
}
//fprintf(stdout, "cells: %d\n", my_cells);
@@ -1,49 +0,0 @@
diff -up procps-3.2.7/ps/parser.c.p3 procps-3.2.7/ps/parser.c
--- procps-3.2.7/ps/parser.c.p3 2008-09-01 11:11:50.000000000 +0200
+++ procps-3.2.7/ps/parser.c 2008-09-01 11:11:50.000000000 +0200
@@ -1238,7 +1238,7 @@ try_bsd:
// as SysV options... and you're screwed if you've been patching
// out the friendly warning. Cut-over is likely to be in 2005.
if(!(personality & PER_FORCE_BSD))
- fprintf(stderr, "Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html\n");
+ fprintf(stderr, "Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-%s/FAQ\n",procps_number_version);
// Remember: contact albert@users.sf.net or procps-feedback@lists.sf.net
// if you should feel tempted. Be damn sure you understand all
// the issues. The same goes for other stuff too, BTW. Please ask.
diff -up procps-3.2.7/proc/version.h.p3 procps-3.2.7/proc/version.h
--- procps-3.2.7/proc/version.h.p3 2002-12-15 01:08:32.000000000 +0100
+++ procps-3.2.7/proc/version.h 2008-09-01 11:11:50.000000000 +0200
@@ -16,6 +16,7 @@ EXTERN_C_BEGIN
extern void display_version(void); /* display suite version */
extern const char procps_version[]; /* global buf for suite version */
+extern const char procps_number_version[]; /* global buf for suite number version */
extern int linux_version_code; /* runtime version of LINUX_VERSION_CODE
in /usr/include/linux/version.h */
diff -up procps-3.2.7/proc/library.map.p3 procps-3.2.7/proc/library.map
--- procps-3.2.7/proc/library.map.p3 2005-03-14 05:32:40.000000000 +0100
+++ procps-3.2.7/proc/library.map 2008-09-01 11:11:50.000000000 +0200
@@ -9,7 +9,7 @@ global:
escape_str; escape_strlist;
openproc; closeproc;
tty_to_dev; dev_to_tty; open_psdb_message; open_psdb; lookup_wchan;
- display_version; procps_version; linux_version_code;
+ display_version; procps_version; procps_number_version; linux_version_code;
Hertz; smp_num_cpus; have_privs;
sprint_uptime; uptime; user_from_uid; print_uptime; loadavg;
pretty_print_signals; print_given_signals; unix_print_signals; signal_name_to_number; signal_number_to_name;
diff -up procps-3.2.7/proc/version.c.p3 procps-3.2.7/proc/version.c
--- procps-3.2.7/proc/version.c.p3 2003-01-29 02:11:43.000000000 +0100
+++ procps-3.2.7/proc/version.c 2008-09-01 11:11:50.000000000 +0200
@@ -16,8 +16,10 @@
#ifdef MINORVERSION
const char procps_version[] = "procps version " VERSION "." SUBVERSION "." MINORVERSION;
+const char procps_number_version[] = VERSION "." SUBVERSION "." MINORVERSION;
#else
const char procps_version[] = "procps version " VERSION "." SUBVERSION;
+const char procps_number_version[] = VERSION "." SUBVERSION;
#endif
void display_version(void) {
@@ -1,23 +0,0 @@
diff -up procps-3.2.7/free.1.hlmem procps-3.2.7/free.1
--- procps-3.2.7/free.1.hlmem 2009-02-24 10:54:35.000000000 +0100
+++ procps-3.2.7/free.1 2009-02-24 11:00:26.000000000 +0100
@@ -7,7 +7,7 @@ free \- Display amount of free and used
.SH SYNOPSIS
.BR "free " [ "\-b" " | " "\-k" " | " "\-m" "] [" "\-o" "] [" "\-s"
.I delay
-.RB "] [" "\-t" "] [" "\-V" ]
+.RB "] [" "\-t" "] [" "\-l" "] [" "\-V" "]
.SH DESCRIPTION
\fBfree\fP displays the total amount of free and used physical and swap
memory in the system, as well as the buffers used by the kernel.
@@ -28,7 +28,9 @@ may actually specify any floating point
.BR usleep (3)
is used for microsecond resolution delay times.
.PP
-The \fB\-V\fP displays version information.
+The \fB-l\fP switch shows detailed low and high memory statistics.
+.PP
+The \fB\-V\fP switch displays version information.
.SH FILES
.ta
.IR /proc/meminfo "\-\- memory information"
@@ -1,61 +0,0 @@
diff -up procps-3.2.7/ps/output.c.p12 procps-3.2.7/ps/output.c
--- procps-3.2.7/ps/output.c.p12 2006-06-19 01:27:02.000000000 +0200
+++ procps-3.2.7/ps/output.c 2008-09-01 11:35:06.000000000 +0200
@@ -1090,7 +1090,7 @@ static int pr_sgi_p(char *restrict const
return snprintf(outbuf, COLWID, "*");
}
-
+#ifdef STATICLIB
/****************** FLASK & seLinux security stuff **********************/
// move the bulk of this to libproc sometime
@@ -1122,7 +1122,7 @@ fail:
return 1;
}
-#if 0
+#else
// This needs more study, considering:
// 1. the static linking option (maybe disable this in that case)
// 2. the -z and -Z option issue
@@ -1134,7 +1134,7 @@ static int pr_context(char *restrict con
char *context;
if(!ps_getpidcon && !tried_load){
- void *handle = dlopen("libselinux.so.1", RTLD_NOW);
+ void *handle = dlopen("libselinux.so", RTLD_NOW);
if(handle){
dlerror();
ps_getpidcon = dlsym(handle, "getpidcon");
diff -up procps-3.2.7/Makefile.p12 procps-3.2.7/Makefile
--- procps-3.2.7/Makefile.p12 2006-06-24 11:02:25.000000000 +0200
+++ procps-3.2.7/Makefile 2008-09-01 11:35:06.000000000 +0200
@@ -73,12 +73,12 @@ CURSES := -lncurses
# Something like this is probably needed to make the SE Linux
# library loading not conflict with embedded systems stuff.
#
-#ifeq ($(SHARED),1)
-#ldl := -ldl
-#LIBTYPE := -DSHAREDLIB
-#else
-#LIBTYPE := -DSTATICLIB
-#endif
+ifeq ($(SHARED),1)
+ldl := -ldl
+LIBTYPE := -DSHAREDLIB
+else
+LIBTYPE := -DSTATICLIB
+endif
# Preprocessor flags.
PKG_CPPFLAGS := -D_GNU_SOURCE -I proc
@@ -103,7 +103,7 @@ PKG_CFLAGS := -fno-common -ffast-math
# Note that some stuff below is conditional on CFLAGS containing
# an option that starts with "-g". (-g, -g2, -g3, -ggdb, etc.)
CFLAGS := -O2 -s
-ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS)
+ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS) $(LIBTYPE)
PKG_LDFLAGS := -Wl,-warn-common
LDFLAGS :=
@@ -1,22 +0,0 @@
--- procps-3.2.7/proc/readproc.c.kzak 2006-06-16 10:18:13.000000000 +0200
+++ procps-3.2.7/proc/readproc.c 2006-09-27 11:25:13.000000000 +0200
@@ -432,14 +432,17 @@
if(fd==-1) return NULL;
/* read whole file into a memory buffer, allocating as we go */
- while ((n = read(fd, buf, sizeof buf - 1)) > 0) {
+ while ((n = read(fd, buf, sizeof buf - 1)) >= 0) {
if (n < (int)(sizeof buf - 1))
end_of_file = 1;
- if (n == 0 && rbuf == 0)
+ if (n == 0 && rbuf == 0) {
+ close(fd);
return NULL; /* process died between our open and read */
+ }
if (n < 0) {
if (rbuf)
free(rbuf);
+ close(fd);
return NULL; /* read error */
}
if (end_of_file && buf[n-1]) /* last read char not null */
@@ -1,36 +0,0 @@
diff -up procps-3.2.7/watch.c.p2 procps-3.2.7/watch.c
--- procps-3.2.7/watch.c.p2 2006-06-17 11:18:38.000000000 +0200
+++ procps-3.2.7/watch.c 2008-09-01 10:46:17.000000000 +0200
@@ -25,6 +25,9 @@
#include <termios.h>
#include <locale.h>
#include "proc/procps.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#ifdef FORCE_8BIT
#undef isprint
@@ -138,6 +141,7 @@ int
main(int argc, char *argv[])
{
int optc;
+ int fd;
int option_differences = 0,
option_differences_cumulative = 0,
option_help = 0, option_version = 0;
@@ -260,7 +264,13 @@ main(int argc, char *argv[])
mvaddstr(0, width - tsl + 1, ts);
free(header);
}
-
+ close(0);
+ fd=open("/dev/null",O_RDWR);
+ if (fd!=0) {
+ perror("open");
+ do_exit(2);
+ }
+
if (!(p = popen(command, "r"))) {
perror("popen");
do_exit(2);
@@ -1,19 +0,0 @@
diff -up procps-3.2.7/top.c.p6 procps-3.2.7/top.c
--- procps-3.2.7/top.c.p6 2006-06-25 08:41:48.000000000 +0200
+++ procps-3.2.7/top.c 2008-09-01 11:28:15.000000000 +0200
@@ -3331,12 +3331,15 @@ static void frame_make (void)
int main (int dont_care_argc, char *argv[])
{
+ struct stat isproc;
(void)dont_care_argc;
before(*argv);
// +-------------+
windows_stage1(); // top (sic) slice
configs_read(); // > spread etc, <
parse_args(&argv[1]); // > lean stuff, <
+ if (stat("/proc/self", &isproc)==-1)
+ std_err("/proc is not mounted, required for output data");
whack_terminal(); // > onions etc. <
windows_stage2(); // as bottom slice
// +-------------+
@@ -1,67 +0,0 @@
diff -up procps-3.2.7/ps/output.c.pom procps-3.2.7/ps/output.c
--- procps-3.2.7/ps/output.c.pom 2009-02-15 13:16:27.000000000 +0100
+++ procps-3.2.7/ps/output.c 2009-02-15 14:02:34.000000000 +0100
@@ -1097,6 +1097,40 @@ static int pr_sgi_p(char *restrict const
return snprintf(outbuf, COLWID, "*");
}
+static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){
+ char filename[48];
+ FILE *fd;
+ int counter = 0;
+ int c;
+ int is_cgroup = 0;
+
+ outbuf[0]='\0';
+ snprintf(filename, sizeof filename, "/proc/%d/cgroup", pp->tgid);
+ fd = fopen(filename, "r");
+ if (likely(fd == NULL)) goto fail;
+ while (( (c = fgetc(fd)) != EOF) && (counter<665)) {
+ if (is_cgroup == 0) {
+ if (c == ':') {
+ is_cgroup = 1;
+ if (counter>0)
+ outbuf[counter++]=';';
+ }
+ }else
+ if ((c == '\n') || (c == '\0'))
+ is_cgroup = 0;
+ else
+ outbuf[counter++]=c;
+ }
+ outbuf[counter]='\0';
+ close(fd);
+ if (counter>0)
+ return counter;
+fail:
+ outbuf[0] = '-';
+ outbuf[1] = '\0';
+ return 1;
+}
+
#ifdef STATICLIB
/****************** FLASK & seLinux security stuff **********************/
// move the bulk of this to libproc sometime
@@ -1291,6 +1325,7 @@ static const format_struct format_array[
{"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, ET|RIGHT},
{"c", "C", pr_c, sr_pcpu, 2, 0, SUN, ET|RIGHT},
{"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigcatch*/
+{"cgroup", "CGROUP", pr_cgroup, sr_nop, 35, 0, LNX, PO|LEFT}, /* cgroups*/
{"class", "CLS", pr_class, sr_sched, 3, 0, XXX, TO|LEFT},
{"cls", "CLS", pr_class, sr_sched, 3, 0, HPU, TO|RIGHT}, /*says HPUX or RT*/
{"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, AN|RIGHT},
diff -up procps-3.2.7/ps/ps.1.pom procps-3.2.7/ps/ps.1
--- procps-3.2.7/ps/ps.1.pom 2009-02-15 13:16:27.000000000 +0100
+++ procps-3.2.7/ps/ps.1 2009-02-15 14:00:33.000000000 +0100
@@ -908,6 +908,10 @@ width of the field, a 32 or 64 bits mask
displayed. (alias\ \fBsig_catch\fR,\ \fBsigcatch\fR).
T}
+cgroup CGROUP T{
+display control groups to which the process belonges.
+t}
+
class CLS T{
scheduling class of the process. (alias\ \fBpolicy\fR,\ \fBcls\fR).
Field's possible values are:
@@ -1,48 +0,0 @@
--- procps-3.2.7/ps/ps.1.eip64 2007-06-14 11:08:35.000000000 +0200
+++ procps-3.2.7/ps/ps.1 2007-06-14 11:03:28.000000000 +0200
@@ -1156,6 +1156,14 @@
or\ a\ decimal representation otherwise.
T}
+rip RIP T{
+64-bit instruction pointer.
+T}
+
+rsp RSP T{
+64-bit stack pointer.
+T}
+
rss RSS T{
resident set size, the non\-swapped physical memory that
a task has used (in\ kiloBytes).
--- procps-3.2.7/ps/output.c.eip64 2007-06-14 11:08:24.000000000 +0200
+++ procps-3.2.7/ps/output.c 2007-06-14 10:58:21.000000000 +0200
@@ -764,10 +764,18 @@
return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->kstk_esp));
}
+static int pr_rsp(char *restrict const outbuf, const proc_t *restrict const pp){
+ return snprintf(outbuf, COLWID, "%016lx", (unsigned long)(pp->kstk_esp));
+}
+
static int pr_eip(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->kstk_eip));
}
+static int pr_rip(char *restrict const outbuf, const proc_t *restrict const pp){
+ return snprintf(outbuf, COLWID, "%016lx", (unsigned long)(pp->kstk_eip));
+}
+
/* This function helps print old-style time formats */
static int old_time_helper(char *dst, unsigned long long t, unsigned long long rel) {
if(!t) return snprintf(dst, COLWID, " -");
@@ -1403,7 +1411,9 @@
{"resident", "RES", pr_nop, sr_resident, 5,MEM, LNX, PO|RIGHT},
{"rgid", "RGID", pr_rgid, sr_rgid, 5, 0, XXX, ET|RIGHT},
{"rgroup", "RGROUP", pr_rgroup, sr_rgroup, 8, GRP, U98, ET|USER}, /* was 8 wide */
+{"rip", "RIP", pr_rip, sr_kstk_eip, 16, 0, LNX, TO|RIGHT},
{"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
+{"rsp", "RSP", pr_rsp, sr_kstk_eip, 16, 0, LNX, TO|RIGHT},
{"rss", "RSS", pr_rss, sr_rss, 5, 0, XXX, PO|RIGHT}, /* was 5 wide */
{"rssize", "RSS", pr_rss, sr_vm_rss, 5, 0, DEC, PO|RIGHT}, /*rsz*/
{"rsz", "RSZ", pr_rss, sr_vm_rss, 5, 0, BSD, PO|RIGHT}, /*rssize*/
@@ -1,11 +0,0 @@
--- procps-3.2.7/ps/output.c.libselinux 2007-08-27 08:34:13.000000000 +0200
+++ procps-3.2.7/ps/output.c 2007-08-27 08:34:30.000000000 +0200
@@ -1141,7 +1141,7 @@
char *context;
if(!ps_getpidcon && !tried_load){
- void *handle = dlopen("libselinux.so", RTLD_NOW);
+ void *handle = dlopen("libselinux.so.1", RTLD_NOW);
if(handle){
dlerror();
ps_getpidcon = dlsym(handle, "getpidcon");
@@ -1,12 +0,0 @@
diff -up procps-3.2.7/ps/ps.1.ps-man-fmt procps-3.2.7/ps/ps.1
--- procps-3.2.7/ps/ps.1.ps-man-fmt 2008-09-01 11:43:18.000000000 +0200
+++ procps-3.2.7/ps/ps.1 2008-09-01 11:43:41.000000000 +0200
@@ -30,7 +30,7 @@
.\" the space needed for the 1st two columns.
.\" Making it messy: inches, ens, points, scaled points...
.\"
-.nr ColSize ((\n(.lu-\n(.iu/\n(.Hu-20u)n)
+.nr ColSize ((\n[.l] - \n[.i]) / 1n - 20)
.\"
.\" This is for command options
.nr OptSize (16u)
@@ -1,71 +0,0 @@
--- procps-3.2.7/ps/output.c.jitter 2007-04-26 13:15:47.000000000 +0200
+++ procps-3.2.7/ps/output.c 2007-04-26 13:31:24.000000000 +0200
@@ -77,7 +77,6 @@
static int wide_signals; /* true if we have room */
static unsigned long seconds_since_1970;
-static unsigned long time_of_boot;
static unsigned long page_shift;
@@ -1952,7 +1951,6 @@
// available space: page_size*outbuf_pages-SPACE_AMOUNT
seconds_since_1970 = time(NULL);
- time_of_boot = seconds_since_1970 - seconds_since_boot;
meminfo();
--- procps-3.2.7/ps/common.h.jitter 2005-01-27 04:43:22.000000000 +0100
+++ procps-3.2.7/ps/common.h 2007-04-26 12:44:01.000000000 +0200
@@ -302,6 +302,7 @@
extern int screen_cols;
extern int screen_rows;
extern unsigned long seconds_since_boot;
+extern unsigned long time_of_boot;
extern selection_node *selection_list;
extern unsigned simple_select;
extern sort_node *sort_list;
--- procps-3.2.7/ps/global.c.jitter 2005-10-30 01:43:34.000000000 +0200
+++ procps-3.2.7/ps/global.c 2007-04-26 13:26:38.000000000 +0200
@@ -70,6 +70,7 @@
int screen_cols = -1;
int screen_rows = -1;
unsigned long seconds_since_boot = -1;
+unsigned long time_of_boot = -1;
selection_node *selection_list = (selection_node *)0xdeadbeef;
unsigned simple_select = 0xffffffff;
sort_node *sort_list = (sort_node *)0xdeadbeef; /* ready-to-use sort list */
@@ -361,7 +362,23 @@
look_up_our_self(&p);
set_screen_size();
set_personality();
-
+ int fd;
+ char *buf[BUFFSIZE];
+ const char *b;
+
+ /* get boot time from /proc/stat */
+ fd = open("/proc/stat", O_RDONLY, 0);
+ if (fd != -1) {
+ buf[BUFFSIZE-1] = 0;
+ read(fd, buf, BUFFSIZE-1);
+ b = strstr(buf, "btime ");
+ if (b) {
+ sscanf(b, "btime %lu", &time_of_boot);
+ seconds_since_boot = time(0) - time_of_boot;
+ }
+ close(fd);
+ }
+
all_processes = 0;
bsd_c_option = 0;
bsd_e_option = 0;
@@ -380,7 +397,6 @@
negate_selection = 0;
page_size = getpagesize();
running_only = 0;
- seconds_since_boot = uptime(0,0);
selection_list = NULL;
simple_select = 0;
sort_list = NULL;
@@ -1,19 +0,0 @@
diff -up procps-3.2.7/top.h.p7 procps-3.2.7/top.h
--- procps-3.2.7/top.h.p7 2006-06-25 08:41:48.000000000 +0200
+++ procps-3.2.7/top.h 2008-09-01 11:29:15.000000000 +0200
@@ -149,8 +149,13 @@ do {
int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \
if (Batch) _ptr = _str; \
else { \
- _ptr = &Pseudo_scrn[Pseudo_row++ * Pseudo_cols]; \
- if (memcmp(_ptr, _str, _len)) { \
+ int _rest; \
+ _ptr = &Pseudo_scrn[Pseudo_row * Pseudo_cols]; \
+ _rest = Pseudo_size-(_ptr-Pseudo_scrn); \
+ Pseudo_row = (Pseudo_row+1) % Screen_rows; \
+ if (_rest < _len) \
+ _len = _rest; \
+ if (memcmp(_ptr, _str, _len)) { \
memcpy(_ptr, _str, _len); \
} else { \
_ptr = "\n"; \
@@ -1,22 +0,0 @@
--- procps-3.2.7/ps/ps.1.psman 2007-06-20 08:30:47.000000000 +0200
+++ procps-3.2.7/ps/ps.1 2007-06-20 08:50:10.000000000 +0200
@@ -21,8 +21,8 @@
.\" See /usr/share/groff/current/tmac/an-old.tmac for what these do.
.\" Setting them to zero provides extra space, but only do that for
.\" plain text output. PostScript and such will remain indented.
-.if n .nr IN 0n
-.if n .nr an-prevailing-indent 0n
+.\" .if n .nr IN 0n
+.\" .if n .nr an-prevailing-indent 0n
.\"
.\"
.\" ColSize is used for the format spec table.
@@ -838,6 +838,8 @@
.\" lB1 lB1 lBw(5.5i)
.\" lB1 l1 l.
.\"
+.RE
+
.TS
expand;
lB1 lB1 lBw(\n[ColSize]n)
@@ -1,113 +0,0 @@
diff -up procps-3.2.7/slabtop.c.once procps-3.2.7/slabtop.c
--- procps-3.2.7/slabtop.c.once 2008-12-11 13:24:52.000000000 +0100
+++ procps-3.2.7/slabtop.c 2008-12-11 13:33:12.000000000 +0100
@@ -268,9 +268,24 @@ static void parse_input(char c)
}
}
+/*printw or printf depending on the context*/
+static void printwf(int once, const char *s,...)
+{
+va_list va;
+
+va_start(va,s);
+if(once)
+ vprintf(s,va);
+else
+ vwprintw(stdscr, s, va);
+va_end(va);
+}
+
+
int main(int argc, char *argv[])
{
int o;
+ int once = 0;
unsigned short old_rows;
struct slab_info *slab_list = NULL;
@@ -307,6 +322,7 @@ int main(int argc, char *argv[])
break;
case 'o':
delay = 0;
+ once = 1;
break;
case 'V':
display_version();
@@ -322,12 +338,18 @@ int main(int argc, char *argv[])
if (tcgetattr(0, &saved_tty) == -1)
perror("tcgetattr");
- initscr();
- term_size(0);
- old_rows = rows;
- resizeterm(rows, cols);
- signal(SIGWINCH, term_size);
- signal(SIGINT, sigint_handler);
+ if(!once) {
+ initscr();
+ term_size(0);
+ old_rows = rows;
+ resizeterm(rows, cols);
+ signal(SIGWINCH, term_size);
+ signal(SIGINT, sigint_handler);
+ } else {
+ old_rows = rows;
+ rows = 80;
+ cols = 24;
+ }
do {
struct slab_info *curr;
@@ -341,12 +363,12 @@ int main(int argc, char *argv[])
break;
if (old_rows != rows) {
- resizeterm(rows, cols);
+ if(!once) resizeterm(rows, cols);
old_rows = rows;
}
move(0,0);
- printw( " Active / Total Objects (%% used) : %d / %d (%.1f%%)\n"
+ printwf(once, " Active / Total Objects (%% used) : %d / %d (%.1f%%)\n"
" Active / Total Slabs (%% used) : %d / %d (%.1f%%)\n"
" Active / Total Caches (%% used) : %d / %d (%.1f%%)\n"
" Active / Total Size (%% used) : %.2fK / %.2fK (%.1f%%)\n"
@@ -360,15 +382,15 @@ int main(int argc, char *argv[])
slab_list = slabsort(slab_list);
- attron(A_REVERSE);
- printw( "%6s %6s %4s %8s %6s %8s %10s %-23s\n",
+ if(!once) attron(A_REVERSE);
+ printwf(once, "%6s %6s %4s %8s %6s %8s %10s %-23s\n",
"OBJS", "ACTIVE", "USE", "OBJ SIZE", "SLABS",
"OBJ/SLAB", "CACHE SIZE", "NAME");
- attroff(A_REVERSE);
+ if(!once) attroff(A_REVERSE);
curr = slab_list;
for (i = 0; i < rows - 8 && curr->next; i++) {
- printw("%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n",
+ printwf(once, "%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n",
curr->nr_objs, curr->nr_active_objs, curr->use,
curr->obj_size / 1024.0, curr->nr_slabs,
curr->objs_per_slab, (unsigned)(curr->cache_size / 1024),
@@ -376,7 +398,7 @@ int main(int argc, char *argv[])
curr = curr->next;
}
- refresh();
+ if(!once) refresh();
put_slabinfo(slab_list);
FD_ZERO(&readfds);
@@ -392,6 +414,6 @@ int main(int argc, char *argv[])
tcsetattr(0, TCSAFLUSH, &saved_tty);
free_slabinfo(slab_list);
- endwin();
+ if(!once) endwin();
return 0;
}
@@ -1,87 +0,0 @@
--- procps-3.2.7/sysctl.c.kzak 2007-04-03 01:26:01.000000000 +0200
+++ procps-3.2.7/sysctl.c 2007-04-03 01:26:13.000000000 +0200
@@ -63,6 +63,44 @@
static const char ERR_PRELOAD_FILE[] = "error: unable to open preload file \"%s\"\n";
static const char WARN_BAD_LINE[] = "warning: %s(%d): invalid syntax, continuing...\n";
+/* Ignore deprecated sysctls
+ * -- we use this list when we scan (DisplayAll) /proc/sys only. We don't use it
+ * in case when user direcly uses deprecated key. It's better when user can read
+ * an error message from kernel.
+ */
+struct sysctl_ignore {
+ const char *prefix;
+ int prefix_len;
+ const char *option;
+ int option_len;
+};
+
+#define IGNORE_ENTRY(prefix, option) \
+ { prefix, sizeof(prefix)-1, option, sizeof(option)-1 }
+
+static struct sysctl_ignore Ignore[] =
+{
+ IGNORE_ENTRY( "net.ipv6.neigh", "base_reachable_time" ),
+ IGNORE_ENTRY( "net.ipv6.neigh", "retrans_time" )
+};
+
+static bool IsIgnored(const char *name)
+{
+ unsigned int i;
+ int sz = strlen(name);
+
+ for (i = 0; i < sizeof(Ignore)/sizeof(struct sysctl_ignore); i++) {
+ struct sysctl_ignore *p = &Ignore[i];
+
+ if (sz < (p->prefix_len + p->option_len))
+ continue;
+
+ if (strncmp(name, p->prefix, p->prefix_len) == 0 &&
+ strcmp(name + (sz - p->option_len), p->option) == 0)
+ return true;
+ }
+ return false;
+}
static void slashdot(char *restrict p, char old, char new){
p = strpbrk(p,"/.");
@@ -122,7 +160,7 @@
* Read a sysctl setting
*
*/
-static int ReadSetting(const char *restrict const name) {
+static int ReadSetting(const char *restrict const name, bool useign) {
int rc = 0;
char *restrict tmpname;
char *restrict outname;
@@ -145,6 +183,12 @@
outname = strdup(name);
slashdot(outname,'/','.'); /* change / to . */
+ if (useign && IsIgnored(outname)) {
+ free(outname);
+ free(tmpname);
+ return rc;
+ }
+
if (stat(tmpname, &st)==0) {
if (st.st_mode & (S_IRUSR|S_IROTH|S_IRGRP))
fp = fopen(tmpname, "r");
@@ -257,7 +301,7 @@
strcat(tmpdir, "/");
DisplayAll(tmpdir);
} else {
- rc |= ReadSetting(tmpdir+strlen(PROC_PATH));
+ rc |= ReadSetting(tmpdir+strlen(PROC_PATH), true);
}
}
free(tmpdir);
@@ -519,7 +563,7 @@
if (WriteMode || index(*argv, '='))
ReturnCode = WriteSetting(*argv);
else
- ReturnCode = ReadSetting(*argv);
+ ReturnCode = ReadSetting(*argv, false);
}
}
@@ -1,56 +0,0 @@
diff -up procps-3.2.7/sysctl.c.p9 procps-3.2.7/sysctl.c
--- procps-3.2.7/sysctl.c.p9 2006-06-25 02:51:51.000000000 +0200
+++ procps-3.2.7/sysctl.c 2008-09-01 11:31:58.000000000 +0200
@@ -127,7 +127,8 @@ static int ReadSetting(const char *restr
char *restrict tmpname;
char *restrict outname;
char inbuf[1025];
- FILE *restrict fp;
+ FILE *restrict fp = NULL;
+ struct stat st;
if (!name || !*name) {
fprintf(stderr, ERR_INVALID_KEY, name);
@@ -144,7 +145,13 @@ static int ReadSetting(const char *restr
outname = strdup(name);
slashdot(outname,'/','.'); /* change / to . */
- fp = fopen(tmpname, "r");
+ if (stat(tmpname, &st)==0) {
+ if (st.st_mode & (S_IRUSR|S_IROTH|S_IRGRP))
+ fp = fopen(tmpname, "r");
+ else
+ /* ignore write-only files */
+ return -1;
+ }
if (!fp) {
switch(errno) {
@@ -158,12 +165,16 @@ static int ReadSetting(const char *restr
fprintf(stderr, ERR_PERMISSION_DENIED, outname);
rc = -1;
break;
+ case EINVAL: /* fopen()/stat() invalid argument */
+ case ENOTTY: /* inappropriate ioctl for device */
+ break;
default:
fprintf(stderr, ERR_UNKNOWN_READING, strerror(errno), outname);
rc = -1;
break;
}
} else {
+ errno=0;
if(fgets(inbuf, sizeof inbuf - 1, fp)) {
// this loop is required, see
// /sbin/sysctl -a | egrep -6 dev.cdrom.info
@@ -183,7 +194,9 @@ static int ReadSetting(const char *restr
}
}
} while(fgets(inbuf, sizeof inbuf - 1, fp));
- } else {
+
+ /* fgets() returns NULL and errno without change if the file is empty */
+ } else if (errno) {
switch(errno) {
case EACCES:
fprintf(stderr, ERR_PERMISSION_DENIED, outname);
@@ -1,19 +0,0 @@
diff -up procps-3.2.7/top.c.clrscr procps-3.2.7/top.c
--- procps-3.2.7/top.c.clrscr 2008-04-08 08:49:48.000000000 +0200
+++ procps-3.2.7/top.c 2008-04-08 08:50:07.000000000 +0200
@@ -2109,6 +2109,7 @@ static void fields_sort (void)
*p = x + 'A';
Curwin->rc.sortindx = x;
putp(Cap_curs_norm);
+ putp(Cap_clr_scr);
}
@@ -2134,6 +2135,7 @@ static void fields_toggle (void)
*p = i + 'A';
}
putp(Cap_curs_norm);
+ putp(Cap_clr_scr);
}
/*###### Windows/Field Groups support #################################*/
@@ -1,20 +0,0 @@
--- procps-3.2.7/top.c.orig 2007-09-07 21:28:41.000000000 +0100
+++ procps-3.2.7/top.c 2007-09-07 21:29:15.000000000 +0100
@@ -959,8 +959,15 @@
// and just in case we're 2.2.xx compiled without SMP support...
if (Cpu_tot == 1) {
- cpus[1].id = 0;
- memcpy(cpus, &cpus[1], sizeof(CPU_t));
+ cpus[0].id = cpus[1].id = 0;
+ cpus[0].u = cpus[1].u;
+ cpus[0].n = cpus[1].n;
+ cpus[0].s = cpus[1].s;
+ cpus[0].i = cpus[1].i;
+ cpus[0].w = cpus[1].w;
+ cpus[0].x = cpus[1].x;
+ cpus[0].y = cpus[1].y;
+ cpus[0].z = cpus[1].z;
}
// now value each separate cpu's tics
@@ -1,12 +0,0 @@
diff -up procps-3.2.7/top.c.cpuint procps-3.2.7/top.c
--- procps-3.2.7/top.c.cpuint 2008-01-11 08:32:44.000000000 +0100
+++ procps-3.2.7/top.c 2008-01-11 08:32:52.000000000 +0100
@@ -1824,7 +1824,7 @@ static void configs_read (void)
if(Rc.mode_irixps && smp_num_cpus>1){
// good for 100 CPUs per process
pcpu_max_value = 9999.0;
- Fieldstab[P_CPU].fmts = " %4.0f";
+ Fieldstab[P_CPU].fmts = " %4.1f";
}
// lastly, establish the true runtime secure mode and delay time
@@ -1,83 +0,0 @@
diff -up procps-3.2.7/top.c.p15 procps-3.2.7/top.c
--- procps-3.2.7/top.c.p15 2008-09-01 11:37:51.000000000 +0200
+++ procps-3.2.7/top.c 2008-09-01 11:37:51.000000000 +0200
@@ -121,6 +121,7 @@ static int No_ksyms = -1, // set t
Secure_mode = 0; // set if some functionality restricted
static int VIRT_vmsize = 0; //use vm_size for VIRT
+static int CPU_loop = 0; // wait for reliable CPU data
/* Some cap's stuff to reduce runtime calls --
to accomodate 'Batch' mode, they begin life as empty strings */
@@ -1679,6 +1680,8 @@ static void before (char *me)
if (( getenv("STATSIZE")) && ( atoi(getenv("STATSIZE")) == 1 ))
VIRT_vmsize = 1;
+ if (( getenv("CPULOOP")) && ( atoi(getenv("CPULOOP")) == 1 ))
+ CPU_loop = 1;
}
@@ -2978,6 +2981,7 @@ static proc_t **summary_show (void)
{
static proc_t **p_table = NULL;
static CPU_t *smpcpu = NULL;
+ static int first = 0;
// whoa first time, gotta' prime the pump...
if (!p_table) {
@@ -3025,6 +3029,28 @@ static proc_t **summary_show (void)
smpcpu = cpus_refresh(smpcpu);
+ if (first==0 && CPU_loop)
+ {
+ int i;
+ CPU_t *cpu;
+ for (i = 0; i < Cpu_tot; i++) {
+ cpu = &smpcpu[i];
+ cpu->u_sav = cpu->u;
+ cpu->s_sav = cpu->s;
+ cpu->n_sav = cpu->n;
+ cpu->i_sav = cpu->i;
+ cpu->w_sav = cpu->w;
+ cpu->x_sav = cpu->x;
+ cpu->y_sav = cpu->y;
+ cpu->z_sav = cpu->z;
+ }
+ tv.tv_sec = Rc.delay_time;
+ tv.tv_usec = (Rc.delay_time - (int)Rc.delay_time) * 1000000;
+ select(0, NULL, NULL, NULL, &tv);
+
+ smpcpu = cpus_refresh(smpcpu);
+ }
+
if (CHKw(Curwin, View_CPUSUM)) {
// display just the 1st /proc/stat line
summaryhlp(&smpcpu[Cpu_tot], "Cpu(s):");
@@ -3050,6 +3076,8 @@ static proc_t **summary_show (void)
}
SETw(Curwin, NEWFRAM_cwo);
+
+ first = 1;
return p_table;
}
diff -up procps-3.2.7/top.1.p15 procps-3.2.7/top.1
--- procps-3.2.7/top.1.p15 2008-09-01 11:37:51.000000000 +0200
+++ procps-3.2.7/top.1 2008-09-01 11:37:51.000000000 +0200
@@ -1183,6 +1183,13 @@ Then ponder this:
Send bug reports to:
Albert D\. Cahalan, <albert@users.sf.net>
+The top command calculates Cpu(s) by looking at the change in CPU time values
+between samples. When you first run it, it has no previous sample to compare
+to, so these initial values are the percentages since boot. It means you need
+at least two loops or you have to ignore summary output from the first loop.
+This is problem for example for batch mode. There is a possible workaround if
+you define the CPULOOP=1 environment variable. The top command will be run one
+extra hidden loop for CPU data before standard output.
.\" ----------------------------------------------------------------------
.SH 8. HISTORY Former top
@@ -1,55 +0,0 @@
diff -up procps-3.2.7/top.c.p14 procps-3.2.7/top.c
--- procps-3.2.7/top.c.p14 2008-09-01 11:36:55.000000000 +0200
+++ procps-3.2.7/top.c 2008-09-01 11:36:55.000000000 +0200
@@ -120,6 +120,8 @@ static int No_ksyms = -1, // set t
Loops = -1, // number of iterations, -1 loops forever
Secure_mode = 0; // set if some functionality restricted
+static int VIRT_vmsize = 0; //use vm_size for VIRT
+
/* Some cap's stuff to reduce runtime calls --
to accomodate 'Batch' mode, they begin life as empty strings */
static char Cap_clr_eol [CAPBUFSIZ],
@@ -1674,6 +1676,9 @@ static void before (char *me)
Fieldstab[P_PPD].fmts = pid_fmt;
Fieldstab[P_PPD].head = " PPID" + 10 - pid_digits;
}
+
+ if (( getenv("STATSIZE")) && ( atoi(getenv("STATSIZE")) == 1 ))
+ VIRT_vmsize = 1;
}
@@ -2207,6 +2212,7 @@ static void reframewins (void)
}
if (!Frames_libflags) Frames_libflags = L_DEFAULT;
if (selection_type=='p') Frames_libflags |= PROC_PID;
+ if (VIRT_vmsize) Frames_libflags |= L_status;
}
@@ -3186,7 +3192,10 @@ static void task_show (const WIN_t *q, c
MKCOL(p->ruser);
break;
case P_VRT:
- MKCOL(scale_num(PAGES_TO_KB(p->size), w, s));
+ if (VIRT_vmsize)
+ MKCOL(scale_num(PAGES_TO_KB(p->vm_size), w, s));
+ else
+ MKCOL(scale_num(PAGES_TO_KB(p->size), w, s));
break;
case P_WCH:
if (No_ksyms) {
diff -up procps-3.2.7/top.1.p14 procps-3.2.7/top.1
--- procps-3.2.7/top.1.p14 2006-06-19 06:33:51.000000000 +0200
+++ procps-3.2.7/top.1 2008-09-01 11:36:55.000000000 +0200
@@ -401,7 +401,8 @@ A task's currently used share of availab
o:\fB VIRT\fR \*(EM Virtual Image (kb)
The total amount of \*(MV used by the task.
It includes all code, data and shared libraries plus pages that have been
-swapped out.
+swapped out. (Note: you can define the STATSIZE=1 environment variable and the VIRT
+will be calculated from the /proc/#/state VmSize field.)
VIRT = SWAP + RES.
@@ -1,24 +0,0 @@
diff -up procps-3.2.7/top.1.cpudesc procps-3.2.7/top.1
--- procps-3.2.7/top.1.cpudesc 2008-01-18 08:04:19.000000000 +0100
+++ procps-3.2.7/top.1 2008-01-18 08:15:49.000000000 +0100
@@ -540,6 +540,20 @@ You\fI move\fR a field to the\fB left\fR
upper case\fR letter and to the\fB right\fR with the\fB lower case\fR
letter.
+.\" ......................................................................
+.SS 2c. SUMMARY Area Fields
+.\" ----------------------------------------------------------------------
+The summary area fields describing CPU statistics are abbreviated. They provide
+information about times spent in:
+ \fR us = user mode
+ \fR sy = system mode
+ \fR ni = low priority user mode (nice)
+ \fR id = idle task
+ \fR wa = I/O waiting
+ \fR hi = servicing IRQs
+ \fR si = servicing soft IRQs
+ \fR st = steal (time given to other DomU instances)
+
.\" ----------------------------------------------------------------------
.SH 3. INTERACTIVE Commands
@@ -1,15 +0,0 @@
diff -up procps-3.2.7/top.c.p10 procps-3.2.7/top.c
--- procps-3.2.7/top.c.p10 2008-09-01 11:33:06.000000000 +0200
+++ procps-3.2.7/top.c 2008-09-01 11:33:06.000000000 +0200
@@ -2462,7 +2462,10 @@ static void windows_stage2 (void)
int i;
for (i = 0; i < GROUPSMAX; i++) {
- win_names(&Winstk[i], Winstk[i].rc.winname);
+ /* Please, never use something like sprintf(x, "%s", x); ... see win_names() */
+ char buf[WINNAMSIZ];
+ strncpy(buf, Winstk[i].rc.winname, WINNAMSIZ);
+ win_names(&Winstk[i], buf);
capsmk(&Winstk[i]);
}
// rely on this next guy to force a call (eventually) to reframewins
@@ -1,98 +0,0 @@
--- procps-3.2.7/top.c.remcpu 2006-07-10 10:41:11.000000000 +0200
+++ procps-3.2.7/top.c 2006-07-10 10:41:35.000000000 +0200
@@ -912,6 +912,7 @@
static CPU_t *cpus_refresh (CPU_t *cpus)
{
static FILE *fp = NULL;
+ static int cpu_max;
int i;
int num;
// enough for a /proc/stat CPU line (not the intr line)
@@ -926,24 +927,29 @@
can hold tics representing the /proc/stat cpu summary (the first
line read) -- that slot supports our View_CPUSUM toggle */
cpus = alloc_c((1 + Cpu_tot) * sizeof(CPU_t));
+ cpu_max = Cpu_tot;
}
+ else if (cpu_max > Cpu_tot)
+ /* move saved CUPs summary to cpu_max possition */
+ memcpy(&cpus[cpu_max], &cpus[Cpu_tot], sizeof(CPU_t));
+
rewind(fp);
fflush(fp);
// first value the last slot with the cpu summary line
if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");
- cpus[Cpu_tot].x = 0; // FIXME: can't tell by kernel version number
- cpus[Cpu_tot].y = 0; // FIXME: can't tell by kernel version number
- cpus[Cpu_tot].z = 0; // FIXME: can't tell by kernel version number
+ cpus[cpu_max].x = 0; // FIXME: can't tell by kernel version number
+ cpus[cpu_max].y = 0; // FIXME: can't tell by kernel version number
+ cpus[cpu_max].z = 0; // FIXME: can't tell by kernel version number
num = sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",
- &cpus[Cpu_tot].u,
- &cpus[Cpu_tot].n,
- &cpus[Cpu_tot].s,
- &cpus[Cpu_tot].i,
- &cpus[Cpu_tot].w,
- &cpus[Cpu_tot].x,
- &cpus[Cpu_tot].y,
- &cpus[Cpu_tot].z
+ &cpus[cpu_max].u,
+ &cpus[cpu_max].n,
+ &cpus[cpu_max].s,
+ &cpus[cpu_max].i,
+ &cpus[cpu_max].w,
+ &cpus[cpu_max].x,
+ &cpus[cpu_max].y,
+ &cpus[cpu_max].z
);
if (num < 4)
std_err("failed /proc/stat read");
@@ -955,7 +961,7 @@
}
// now value each separate cpu's tics
- for (i = 0; 1 < Cpu_tot && i < Cpu_tot; i++) {
+ for (i = 0; ; i++) {
if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");
cpus[i].x = 0; // FIXME: can't tell by kernel version number
cpus[i].y = 0; // FIXME: can't tell by kernel version number
@@ -964,9 +970,35 @@
&cpus[i].id,
&cpus[i].u, &cpus[i].n, &cpus[i].s, &cpus[i].i, &cpus[i].w, &cpus[i].x, &cpus[i].y, &cpus[i].z
);
- if (num < 4)
- std_err("failed /proc/stat read");
+ if (num < 4) {
+ Cpu_tot = i;
+ break;
+ }
+ if (i == cpu_max - 1) {
+ // Bump cpu_max and extend cpus
+ cpu_max++;
+ cpus = realloc(cpus, (1 + cpu_max) * sizeof(CPU_t));
+ if (!cpus) std_err("realloc failed");
+ memcpy(&cpus[cpu_max], &cpus[cpu_max-1], sizeof(CPU_t));
+ }
+ }
+
+ if (cpu_max > Cpu_tot)
+ memcpy(&cpus[Cpu_tot], &cpus[cpu_max], sizeof(CPU_t));
+
+ // and just in case we're 2.2.xx compiled without SMP support...
+ if (Cpu_tot == 1) {
+ cpus[0].id = cpus[1].id = 0;
+ cpus[0].u = cpus[1].u;
+ cpus[0].n = cpus[1].n;
+ cpus[0].s = cpus[1].s;
+ cpus[0].i = cpus[1].i;
+ cpus[0].w = cpus[1].w;
+ cpus[0].x = cpus[1].x;
+ cpus[0].y = cpus[1].y;
+ cpus[0].z = cpus[1].z;
}
+
return cpus;
}
@@ -1,37 +0,0 @@
--- procps-3.2.7/top.c.sorthigh 2007-02-05 09:06:34.000000000 +0100
+++ procps-3.2.7/top.c 2007-02-05 09:09:35.000000000 +0100
@@ -3121,6 +3121,7 @@
unsigned w = Fieldstab[i].width;
int advance = (x==0) && !Rc.mode_altscr;
+ f += advance;
switch (i) {
case P_CMD:
@@ -3179,7 +3180,7 @@
break;
case P_PRI:
if (unlikely(-99 > p->priority) || unlikely(999 < p->priority)) {
- f = " RT";
+ f = advance ? " RT" : " RT";
MKCOL("");
} else
MKCOL((int)p->priority);
@@ -3227,7 +3228,7 @@
break;
case P_WCH:
if (No_ksyms) {
- f = " %08lx ";
+ f = advance ? "%08lx " : " %08lx ";
MKCOL((long)p->wchan);
} else {
MKCOL(lookup_wchan(p->wchan, p->XXXID));
@@ -3236,7 +3237,7 @@
} /* end: switch 'procflag' */
- rp = scat(rp, cbuf+advance);
+ rp = scat(rp, cbuf);
} /* end: for 'maxpflgs' */
PUFF(
@@ -1,342 +0,0 @@
--- procps-3.2.7/top.1
+++ procps-3.2.7/top.1 2006-06-26 16:34:01.000000000 +0200
@@ -20,7 +20,7 @@
..
.\" Setup ////////////////////////////////////////////////////////////////
\# ** Comment out '.nr' or set to 0 to eliminate WIDTH fiddlin' !
-.nr half_xtra 4
+.nr half_xtra 0
.
.ll +(\n[half_xtra] + \n[half_xtra])
.
@@ -504,7 +504,7 @@ and 'Order fields' screens.
.\" ......................................................................
.SS 2b. SELECTING and ORDERING Columns
.\" ----------------------------------------------------------------------
-After pressing the \*(CIs 'f' (Fields select) or \'o' (Order fields) you will
+After pressing the \*(CIs 'f' (Fields select) or 'o' (Order fields) you will
be shown a screen containing the current \fBfields string\fR followed by names
and descriptions for all fields.
@@ -580,7 +580,7 @@ Use either of these keys if you have a l
see current status,
.TP 7
-\ \ \'\fB?\fR\' or \'\fBh\fR\' :\fIHelp\fR
+\ \ '\fB?\fR' or '\fBh\fR' :\fIHelp\fR
There are two help levels available.
The first will provide a reminder of all the basic \*(CIs.
If \*(Me is\fI secured\fR, that screen will be abbreviated.
@@ -589,7 +589,7 @@ Typing 'h' or '?' on that help screen wi
applicable to \*(AM.
.TP 7
-\ \ \'\fB=\fR\' :\fIExit_Task_Limits\fR
+\ \ '\fB=\fR' :\fIExit_Task_Limits\fR
Removes restrictions on which tasks are shown.
This command will reverse any 'i' (idle tasks) and 'n' (max tasks) commands
that might be active.
@@ -599,13 +599,13 @@ See the '-p' \*(CO for a discussion of P
When operating in \*(AM this command has a slightly broader meaning.
.TP 7
-\ \ \'\fBA\fR\' :\fIAlternate_Display_Mode_toggle\fR
+\ \ '\fBA\fR' :\fIAlternate_Display_Mode_toggle\fR
This command will switch between \*(FM and \*(AM.
\*(XT 4. ALTERNATE\-DISPLAY Mode and the 'G' \*(CI for insight into
\*(CWs and field groups.
.TP 7
-\ \ \'\fBB\fR\' :\fIBold_Disable/Enable_toggle\fR
+\ \ '\fBB\fR' :\fIBold_Disable/Enable_toggle\fR
This command will influence use of the 'bold' terminfo capability and
alters\fB both\fR the \*(SA and \*(TA for the \*(CW.
While it is intended primarily for use with dumb terminals, it can be
@@ -617,7 +617,7 @@ Thus, unless the 'x' and/or 'y' toggles
there will be no visual confirmation that they are even on.
.TP 7
-*\ \'\fBd\fR\' or \'\fBs\fR\' :\fIChange_Delay_Time_interval\fR
+*\ '\fBd\fR' or '\fBs\fR' :\fIChange_Delay_Time_interval\fR
You will be prompted to enter the delay time, in seconds, between
display updates.
@@ -631,32 +631,32 @@ If at any time you wish to know the curr
and view the system summary on the second line.
.TP 7
-\ \ \'\fBG\fR\' :\fIChoose_Another_Window/Field_Group\fR
+\ \ '\fBG\fR' :\fIChoose_Another_Window/Field_Group\fR
You will be prompted to enter a number between 1 and 4 designating the
window/field group which should be made the \*(CW.
You will soon grow comfortable with these 4 windows, especially after
experimenting with \*(AM.
.TP 7
-\ \ \'\fBI\fR\' :\fIIrix/Solaris_Mode_toggle\fR
+\ \ '\fBI\fR' :\fIIrix/Solaris_Mode_toggle\fR
When operating in 'Solaris mode' ('I' toggled \*F), a task's \*(Pu usage
will be divided by the total number of \*(PUs.
After issuing this command, you'll be informed of the new state of this toggle.
.TP 7
-\ \ \'\fBu\fR\' :\fIselect a user\fR
+\ \ '\fBu\fR' :\fIselect a user\fR
You will be prompted for a UID or username. Only processes
belonging to the selected user will be displayed. This option
matches on the effective UID.
.TP 7
-\ \ \'\fBU\fR\' :\fIselect a user\fR
+\ \ '\fBU\fR' :\fIselect a user\fR
You will be prompted for a UID or username. Only processes
belonging to the selected user will be displayed. This option
matches on the real, effective, saved, and filesystem UID.
.TP 7
-*\ \'\fBk\fR\' :\fIKill_a_task\fR
+*\ '\fBk\fR' :\fIKill_a_task\fR
You will be prompted for a PID and then the signal to send.
The default signal, as reflected in the prompt, is SIGTERM.
However, you can send any signal, via number or name.
@@ -667,24 +667,24 @@ depending on your progress:
2) at the signal prompt, type 0
.TP 7
-\ \ \'\fBq\fR\' :\fIQuit\fR
+\ \ '\fBq\fR' :\fIQuit\fR
.TP 7
-*\ \'\fBr\fR\' :\fIRenice_a_Task\fR
+*\ '\fBr\fR' :\fIRenice_a_Task\fR
You will be prompted for a PID and then the value to nice it to.
Entering a positive value will cause a process to lose priority.
Conversely, a negative value will cause a process to be viewed more
favorably by the kernel.
.TP 7
-\ \ \'\fBW\fR\' :\fIWrite_the_Configuration_File\fR
+\ \ '\fBW\fR' :\fIWrite_the_Configuration_File\fR
This will save all of your options and toggles plus the current
display mode and delay time.
By issuing this command just before quitting \*(Me, you will be able restart
later in exactly that same state.
.TP 7
-\ \ \'\fBZ\fR\' :\fIChange_Color_Mapping
+\ \ '\fBZ\fR' :\fIChange_Color_Mapping
This key will take you to a separate screen where you can change the
colors for the \*(CW, or for all windows.
For details regarding this \*(CI \*(Xt 3d. COLOR Mapping.
@@ -704,21 +704,21 @@ These commands always impact just the \*
\*(CWs and field groups.
.TP 7
-\ \ \'\fBl\fR\' :\fIToggle_Load_Average/Uptime\fR \*(EM On/Off
+\ \ '\fBl\fR' :\fIToggle_Load_Average/Uptime\fR \*(EM On/Off
This is also the line containing the program name (possibly an alias) when
operating in \*(FM or the \*(CW name when operating in \*(AM.
.TP 7
-\ \ \'\fBm\fR\' :\fIToggle_Memory/Swap_Usage\fR \*(EM On/Off
+\ \ '\fBm\fR' :\fIToggle_Memory/Swap_Usage\fR \*(EM On/Off
This command affects two \*(SA lines.
.TP 7
-\ \ \'\fBt\fR\' :\fIToggle_Task/Cpu_States\fR \*(EM On/Off
+\ \ '\fBt\fR' :\fIToggle_Task/Cpu_States\fR \*(EM On/Off
This command affects from 2 to many \*(SA lines, depending on the state
of the '1' toggle and whether or not \*(Me is running under true SMP.
.TP 7
-\ \ \'\fB1\fR\' :\fIToggle_Single/Separate_Cpu_States\fR \*(EM On/Off
+\ \ '\fB1\fR' :\fIToggle_Single/Separate_Cpu_States\fR \*(EM On/Off
This command affects how the 't' command's Cpu States portion is shown.
Although this toggle exists primarily to serve massively-parallel SMP machines,
it is not restricted to solely SMP environments.
@@ -750,12 +750,12 @@ global 'B' (bold disable) toggle.
.in
.TP 7
-\ \ \'\fBb\fR\' :\fIBold/Reverse_toggle\fR
+\ \ '\fBb\fR' :\fIBold/Reverse_toggle\fR
This command will impact how the 'x' and 'y' toggles are displayed.
Further, it will only be available when at least one of those toggles is \*O.
.TP 7
-\ \ \'\fBx\fR\' :\fIColumn_Highlight_toggle\fR
+\ \ '\fBx\fR' :\fIColumn_Highlight_toggle\fR
Changes highlighting for the current sort field.
You probably don't need a constant visual reminder of the sort field and
\*(Me hopes that you always run with 'column highlight' \*F, due to the cost
@@ -765,7 +765,7 @@ If you forget which field is being sorte
visual reminder.
.TP 7
-\ \ \'\fBy\fR\' :\fIRow_Highlight_toggle\fR
+\ \ '\fBy\fR' :\fIRow_Highlight_toggle\fR
Changes highlighting for "running" tasks.
For additional insight into this task state, \*(Xt 2a. DESCRIPTIONS of Fields,
Process Status.
@@ -774,7 +774,7 @@ Use of this provision provides important
The only costs will be a few additional tty escape sequences.
.TP 7
-\ \ \'\fBz\fR\' :\fIColor/Monochrome_toggle\fR
+\ \ '\fBz\fR' :\fIColor/Monochrome_toggle\fR
Switches the \*(CW between your last used color scheme and the older form
of black-on-white or white-on-black.
This command will alter\fB both\fR the \*(SA and \*(TA but does not affect the
@@ -785,24 +785,24 @@ state of the 'x', 'y' or 'b' toggles.
.B CONTENT\fR of \*(TW
.PD 0
.TP 7
-\ \ \'\fBc\fR\' :\fICommand_Line/Program_Name_toggle\fR
+\ \ '\fBc\fR' :\fICommand_Line/Program_Name_toggle\fR
This command will be honored whether or not the 'Command' column
is currently visible.
Later, should that field come into view, the change you applied will be seen.
.TP 7
-\ \ \'\fBf\fR\' and \'\fBo\fR\' :\fIFields_select\fR or \fIOrder_fields\fR
+\ \ '\fBf\fR' and '\fBo\fR' :\fIFields_select\fR or \fIOrder_fields\fR
These keys display separate screens where you can change which
fields are displayed and their order.
For additional information on these \*(CIs
\*(Xt 2b. SELECTING and ORDERING Columns.
.TP 7
-\ \ \'\fBH\fR\' :\fIThreads_toggle\fR
+\ \ '\fBH\fR' :\fIThreads_toggle\fR
When this toggle is \*O, all individual threads will be displayed. Otherwise, \*(Me displays a summation of all threads in a process.
.TP 7
-\ \ \'\fBS\fR\' :\fICumulative_Time_Mode_toggle\fR
+\ \ '\fBS\fR' :\fICumulative_Time_Mode_toggle\fR
When 'Cumulative mode' is \*O, each process is listed with the \*(Pu
time that it and its dead children have used.
@@ -818,7 +818,7 @@ If you wish to know in advance whether o
effect, simply ask for help and view the window summary on the second line.
.TP 7
-\ \ \'\fBu\fR\' :\fIShow_Specific_User_Only\fR
+\ \ '\fBu\fR' :\fIShow_Specific_User_Only\fR
You will be prompted to enter the name of the user to display.
Thereafter, in that \*(TW only matching User ID's will be shown, or possibly
no tasks will be shown.
@@ -831,7 +831,7 @@ just press <Enter> at the prompt, withou
.B SIZE\fR of \*(TW
.PD 0
.TP 7
-\ \ \'\fBi\fR\' :\fIIdle_Processes_toggle\fR
+\ \ '\fBi\fR' :\fIIdle_Processes_toggle\fR
Displays all tasks or just active tasks.
When this toggle is \*F, idled or zombied processes will not be displayed.
@@ -839,7 +839,7 @@ If this command is applied to the last \
affect the window's size, as all prior \*(TDs will have already been painted.
.TP 7
-\ \ \'\fBn\fR\' or \'#\' :\fISet_Maximum_Tasks\fR
+\ \ '\fBn\fR' or '#' :\fISet_Maximum_Tasks\fR
You will be prompted to enter the number of tasks to display.
The lessor of your number and available screen rows will be used.
@@ -878,12 +878,12 @@ The sort field might\fI not\fR be visibl
.in
.TP 7
-\ \ \'\fB<\fR\' :\fIMove_Sort_Field_Left\fR
+\ \ '\fB<\fR' :\fIMove_Sort_Field_Left\fR
Moves the sort column to the left unless the current sort field is
the first field being displayed.
.TP 7
-\ \ \'\fB>\fR\' :\fIMove_Sort_Field_Right\fR
+\ \ '\fB>\fR' :\fIMove_Sort_Field_Right\fR
Moves the sort column to the right unless the current sort field is
the last field being displayed.
@@ -894,7 +894,7 @@ the current sort field is visible.
.in
.TP 7
-\ \ \'\fBF\fR\' or \'\fBO\fR\' :\fISelect_Sort_Field\fR
+\ \ '\fBF\fR' or '\fBO\fR' :\fISelect_Sort_Field\fR
These keys display a separate screen where you can change which field
is used as the sort column.
@@ -907,7 +907,7 @@ This \*(CI can be a convenient way to si
when running \*(Me with column highlighting turned \*F.
.TP 7
-\ \ \'\fBR\fR\' :\fIReverse/Normal_Sort_Field_toggle\fR
+\ \ '\fBR\fR' :\fIReverse/Normal_Sort_Field_toggle\fR
Using this \*(CI you can alternate between high-to-low and low-to-high sorts.
.PP
@@ -984,7 +984,7 @@ know what window is the \*(CW.
.\" ......................................................................
.SS 4b. COMMANDS for Windows
.TP 7
-\ \ \'\fB-\fR\' and \'\fB_\fR\' :\fIShow/Hide_Window(s)_toggles\fR
+\ \ '\fB-\fR' and '\fB_\fR' :\fIShow/Hide_Window(s)_toggles\fR
The '-' key turns the \*(CW's \*(TD \*O and \*F.
When \*O, that \*(TA will show a minimum of the columns header you've
established with the 'f' and 'o' commands.
@@ -998,7 +998,7 @@ If all 4 \*(TDs are currently visible, t
as the only display element.
.TP 7
-*\ \'\fB=\fR\' and \'\fB+\fR\' :\fIEqualize_(re-balance)_Window(s)\fR
+*\ '\fB=\fR' and '\fB+\fR' :\fIEqualize_(re-balance)_Window(s)\fR
The '=' key forces the \*(CW's \*(TD to be visible.
It also reverses any 'i' (idle tasks) and 'n' (max tasks) commands that might
be active.
@@ -1009,7 +1009,7 @@ They will also have retained any customi
except for the 'i' (idle tasks) and 'n' (max tasks) commands.
.TP 7
-*\ \'\fBA\fR\' :\fIAlternate_Display_Mode_toggle\fR
+*\ '\fBA\fR' :\fIAlternate_Display_Mode_toggle\fR
This command will switch between \*(FM and \*(AM.
The first time you issue this command, all four \*(TDs will be shown.
@@ -1017,7 +1017,7 @@ Thereafter when you switch modes, you wi
chosen to make visible.
.TP 7
-*\ \'\fBa\fR\' and \'\fBw\fR\' :\fINext_Window_Forward/Backward\fR
+*\ '\fBa\fR' and '\fBw\fR' :\fINext_Window_Forward/Backward\fR
This will change the \*(CW, which in turn changes the window to which
commands are directed.
These keys act in a circular fashion so you can reach any desired \*(CW
@@ -1028,7 +1028,7 @@ whenever the \*(CW name loses its emphas
the \*(TD is \*F and many commands will be restricted.
.TP 7
-*\ \'\fBG\fR\' :\fIChoose_Another_Window/Field_Group\fR
+*\ '\fBG\fR' :\fIChoose_Another_Window/Field_Group\fR
You will be prompted to enter a number between 1 and 4 designating the
window/field group which should be made the \*(CW.
@@ -1037,15 +1037,15 @@ In \*(AM, it is simply a less convenient
commands.
.TP 7
-\ \ \'\fBg\fR\' :\fIChange_Window/Field_Group_Name\fR
+\ \ '\fBg\fR' :\fIChange_Window/Field_Group_Name\fR
You will be prompted for a new name to be applied to the \*(CW.
It does not require that the window name be visible
(the 'l' toggle to be \*O).
.IP "*" 3
The \*(CIs shown with an \*(AS have use beyond \*(AM.
- \'=', 'A', 'G' are always available
- \'a', 'w' act the same when color mapping
+ '=', 'A', 'G' are always available
+ 'a', 'w' act the same when color mapping
.\" ----------------------------------------------------------------------
@@ -1,52 +0,0 @@
--- procps-3.2.7/vmstat.c.steal 2006-07-10 10:49:49.000000000 +0200
+++ procps-3.2.7/vmstat.c 2006-07-10 10:54:03.000000000 +0200
@@ -150,15 +150,15 @@
////////////////////////////////////////////////////////////////////////////
static void new_header(void){
- printf("procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----\n");
+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n");
printf(
- "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s\n",
+ "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n",
"r","b",
"swpd", "free", a_option?"inact":"buff", a_option?"active":"cache",
"si","so",
"bi","bo",
"in","cs",
- "us","sy","id","wa"
+ "us","sy","id","wa", "st"
);
}
@@ -173,7 +173,7 @@
////////////////////////////////////////////////////////////////////////////
static void new_format(void) {
- const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u\n";
+ const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
unsigned int tog=0; /* toggle switch for cleaner code */
unsigned int i;
unsigned int hz = Hertz;
@@ -217,8 +217,8 @@
(unsigned)( (100*duse + divo2) / Div ),
(unsigned)( (100*dsys + divo2) / Div ),
(unsigned)( (100*didl + divo2) / Div ),
- (unsigned)( (100*diow + divo2) / Div ) /* ,
- (unsigned)( (100*dstl + divo2) / Div ) */
+ (unsigned)( (100*diow + divo2) / Div ),
+ (unsigned)( (100*dstl + divo2) / Div )
);
for(i=1;i<num_updates;i++) { /* \\\\\\\\\\\\\\\\\\\\ main loop ////////////////// */
@@ -266,8 +266,8 @@
(unsigned)( (100*duse+divo2)/Div ), /*us*/
(unsigned)( (100*dsys+divo2)/Div ), /*sy*/
(unsigned)( (100*didl+divo2)/Div ), /*id*/
- (unsigned)( (100*diow+divo2)/Div )/*, //wa
- (unsigned)( (100*dstl+divo2)/Div ) //st */
+ (unsigned)( (100*diow+divo2)/Div ), //wa
+ (unsigned)( (100*dstl+divo2)/Div ) //st
);
}
}
@@ -1,12 +0,0 @@
diff -up procps-3.2.7/vmstat.c.jx procps-3.2.7/vmstat.c
--- procps-3.2.7/vmstat.c.jx 2009-01-07 14:13:52.000000000 -0500
+++ procps-3.2.7/vmstat.c 2009-01-07 14:17:07.000000000 -0500
@@ -150,7 +150,7 @@ static int format_1000(unsigned long lon
////////////////////////////////////////////////////////////////////////////
static void new_header(void){
- printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n");
+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\n");
printf(
"%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n",
"r","b",
@@ -1,95 +0,0 @@
diff -up procps-3.2.7/proc/sysinfo.c.vmstat procps-3.2.7/proc/sysinfo.c
--- procps-3.2.7/proc/sysinfo.c.vmstat 2008-12-04 15:25:50.000000000 +0100
+++ procps-3.2.7/proc/sysinfo.c 2008-12-04 16:54:29.000000000 +0100
@@ -784,6 +784,18 @@ unsigned int getpartitions_num(struct di
}
/////////////////////////////////////////////////////////////////////////////
+static int is_disk(char *dev)
+{
+ char syspath[PATH_MAX];
+ char *slash;
+
+ while ((slash = strchr(dev, '/')))
+ *slash = '!';
+ snprintf(syspath, sizeof(syspath), "/sys/block/%s", dev);
+ return !(access(syspath, F_OK));
+}
+
+/////////////////////////////////////////////////////////////////////////////
unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **partitions){
FILE* fd;
@@ -791,6 +803,7 @@ unsigned int getdiskstat(struct disk_sta
int cPartition = 0;
int fields;
unsigned dummy;
+ char devname[PATH_MAX];
*disks = NULL;
*partitions = NULL;
@@ -803,10 +816,11 @@ unsigned int getdiskstat(struct disk_sta
fclose(fd);
break;
}
- fields = sscanf(buff, " %*d %*d %*s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", &dummy);
- if (fields == 1){
+ fields = sscanf(buff, " %*d %*d %15s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u",
+ &devname, &dummy);
+ if (fields == 2 && is_disk(devname)){
(*disks) = realloc(*disks, (cDisk+1)*sizeof(struct disk_stat));
- sscanf(buff, " %*d %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u",
+ sscanf(buff, " %*d %*d %15s %lu %lu %llu %lu %lu %lu %llu %lu %lu %lu %lu",
//&disk_major,
//&disk_minor,
(*disks)[cDisk].disk_name,
@@ -827,7 +841,9 @@ unsigned int getdiskstat(struct disk_sta
}else{
(*partitions) = realloc(*partitions, (cPartition+1)*sizeof(struct partition_stat));
fflush(stdout);
- sscanf(buff, " %*d %*d %15s %u %llu %u %u",
+ sscanf(buff, (fields == 2)
+ ? " %*d %*d %15s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u"
+ : " %*d %*d %15s %u %llu %u %llu",
//&part_major,
//&part_minor,
(*partitions)[cPartition].partition_name,
diff -up procps-3.2.7/proc/sysinfo.h.vmstat procps-3.2.7/proc/sysinfo.h
--- procps-3.2.7/proc/sysinfo.h.vmstat 2008-12-04 15:25:41.000000000 +0100
+++ procps-3.2.7/proc/sysinfo.h 2008-12-04 16:54:32.000000000 +0100
@@ -95,16 +95,16 @@ typedef struct disk_stat{
unsigned long long reads_sectors;
unsigned long long written_sectors;
char disk_name [16];
- unsigned inprogress_IO;
- unsigned merged_reads;
- unsigned merged_writes;
- unsigned milli_reading;
- unsigned milli_spent_IO;
- unsigned milli_writing;
- unsigned partitions;
- unsigned reads;
- unsigned weighted_milli_spent_IO;
- unsigned writes;
+ unsigned long inprogress_IO;
+ unsigned long merged_reads;
+ unsigned long merged_writes;
+ unsigned long milli_reading;
+ unsigned long milli_spent_IO;
+ unsigned long milli_writing;
+ unsigned long partitions;
+ unsigned long reads;
+ unsigned long weighted_milli_spent_IO;
+ unsigned long writes;
}disk_stat;
typedef struct partition_stat{
@@ -113,7 +113,7 @@ typedef struct partition_stat{
unsigned parent_disk; // index into a struct disk_stat array
unsigned reads;
unsigned writes;
- unsigned requested_writes;
+ unsigned long long requested_writes;
}partition_stat;
extern unsigned int getpartitions_num(struct disk_stat *disks, int ndisks);
@@ -1,12 +0,0 @@
diff -up procps-3.2.7/vmstat.c.vmstat procps-3.2.7/vmstat.c
--- procps-3.2.7/vmstat.c.vmstat 2009-02-23 13:44:27.000000000 +0100
+++ procps-3.2.7/vmstat.c 2009-02-23 13:45:03.000000000 +0100
@@ -312,7 +312,7 @@ static int diskpartition_format(const ch
struct disk_stat *disks;
struct partition_stat *partitions, *current_partition=NULL;
unsigned long ndisks, j, k, npartitions;
- const char format[] = "%20u %10llu %10u %10u\n";
+ const char format[] = "%20u %10llu %10u %10llu\n";
fDiskstat=fopen("/proc/diskstats","rb");
if(!fDiskstat){
@@ -1,235 +0,0 @@
--- procps-3.2.7/proc/sysinfo.h.kzak 2006-06-25 08:41:48.000000000 +0200
+++ procps-3.2.7/proc/sysinfo.h 2006-08-04 11:19:09.000000000 +0200
@@ -57,7 +57,7 @@
#define BUFFSIZE (64*1024)
typedef unsigned long long jiff;
extern void getstat(jiff *restrict cuse, jiff *restrict cice, jiff *restrict csys, jiff *restrict cide, jiff *restrict ciow, jiff *restrict cxxx, jiff *restrict cyyy, jiff *restrict czzz,
- unsigned long *restrict pin, unsigned long *restrict pout, unsigned long *restrict s_in, unsigned long *restrict sout,
+ unsigned long long *restrict pin, unsigned long long *restrict pout, unsigned long long *restrict s_in, unsigned long long *restrict sout,
unsigned *restrict intr, unsigned *restrict ctxt,
unsigned int *restrict running, unsigned int *restrict blocked,
unsigned int *restrict btime, unsigned int *restrict processes);
@@ -72,10 +72,10 @@
extern unsigned long vm_nr_reverse_maps;
extern unsigned long vm_nr_mapped;
extern unsigned long vm_nr_slab;
-extern unsigned long vm_pgpgin;
-extern unsigned long vm_pgpgout;
-extern unsigned long vm_pswpin;
-extern unsigned long vm_pswpout;
+extern unsigned long long vm_pgpgin;
+extern unsigned long long vm_pgpgout;
+extern unsigned long long vm_pswpin;
+extern unsigned long long vm_pswpout;
extern unsigned long vm_pgalloc;
extern unsigned long vm_pgfree;
extern unsigned long vm_pgactivate;
--- procps-3.2.7/proc/sysinfo.c.kzak 2006-06-25 08:41:48.000000000 +0200
+++ procps-3.2.7/proc/sysinfo.c 2006-08-04 12:04:06.000000000 +0200
@@ -368,7 +368,7 @@
/***********************************************************************/
void getstat(jiff *restrict cuse, jiff *restrict cice, jiff *restrict csys, jiff *restrict cide, jiff *restrict ciow, jiff *restrict cxxx, jiff *restrict cyyy, jiff *restrict czzz,
- unsigned long *restrict pin, unsigned long *restrict pout, unsigned long *restrict s_in, unsigned long *restrict sout,
+ unsigned long long *restrict pin, unsigned long long *restrict pout, unsigned long long *restrict s_in, unsigned long long *restrict sout,
unsigned *restrict intr, unsigned *restrict ctxt,
unsigned int *restrict running, unsigned int *restrict blocked,
unsigned int *restrict btime, unsigned int *restrict processes) {
@@ -396,11 +396,11 @@
if(b) sscanf(b, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", cuse, cice, csys, cide, ciow, cxxx, cyyy, czzz);
b = strstr(buff, "page ");
- if(b) sscanf(b, "page %lu %lu", pin, pout);
+ if(b) sscanf(b, "page %llu %llu", pin, pout);
else need_vmstat_file = 1;
b = strstr(buff, "swap ");
- if(b) sscanf(b, "swap %lu %lu", s_in, sout);
+ if(b) sscanf(b, "swap %llu %llu", s_in, sout);
else need_vmstat_file = 1;
b = strstr(buff, "intr ");
@@ -611,9 +611,12 @@
typedef struct vm_table_struct {
const char *name; /* VM statistic name */
- unsigned long *slot; /* slot in return struct */
+ void *slot; /* slot in return struct */
+ int sz; /* size of slot value */
} vm_table_struct;
+#define VM_TABENTRY(_name_) { # _name_, &vm_ ## _name_, sizeof(vm_ ## _name_) }
+
static int compare_vm_table_structs(const void *a, const void *b){
return strcmp(((const vm_table_struct*)a)->name,((const vm_table_struct*)b)->name);
}
@@ -626,10 +629,10 @@
unsigned long vm_nr_reverse_maps; // includes PageDirect
unsigned long vm_nr_mapped; // mapped into pagetables
unsigned long vm_nr_slab; // in slab
-unsigned long vm_pgpgin; // kB disk reads (same as 1st num on /proc/stat page line)
-unsigned long vm_pgpgout; // kB disk writes (same as 2nd num on /proc/stat page line)
-unsigned long vm_pswpin; // swap reads (same as 1st num on /proc/stat swap line)
-unsigned long vm_pswpout; // swap writes (same as 2nd num on /proc/stat swap line)
+unsigned long long vm_pgpgin; // kB disk reads (same as 1st num on /proc/stat page line)
+unsigned long long vm_pgpgout; // kB disk writes (same as 2nd num on /proc/stat page line)
+unsigned long long vm_pswpin; // swap reads (same as 1st num on /proc/stat swap line)
+unsigned long long vm_pswpout; // swap writes (same as 2nd num on /proc/stat swap line)
unsigned long vm_pgalloc; // page allocations
unsigned long vm_pgfree; // page freeings
unsigned long vm_pgactivate; // pages moved inactive -> active
@@ -668,54 +671,54 @@
void vminfo(void){
char namebuf[16]; /* big enough to hold any row name */
- vm_table_struct findme = { namebuf, NULL};
+ vm_table_struct findme = { namebuf, NULL, 0};
vm_table_struct *found;
char *head;
char *tail;
static const vm_table_struct vm_table[] = {
- {"allocstall", &vm_allocstall},
- {"kswapd_inodesteal", &vm_kswapd_inodesteal},
- {"kswapd_steal", &vm_kswapd_steal},
- {"nr_dirty", &vm_nr_dirty}, // page version of meminfo Dirty
- {"nr_mapped", &vm_nr_mapped}, // page version of meminfo Mapped
- {"nr_page_table_pages", &vm_nr_page_table_pages},// same as meminfo PageTables
- {"nr_pagecache", &vm_nr_pagecache}, // gone in 2.5.66+ kernels
- {"nr_reverse_maps", &vm_nr_reverse_maps}, // page version of meminfo ReverseMaps GONE
- {"nr_slab", &vm_nr_slab}, // page version of meminfo Slab
- {"nr_unstable", &vm_nr_unstable},
- {"nr_writeback", &vm_nr_writeback}, // page version of meminfo Writeback
- {"pageoutrun", &vm_pageoutrun},
- {"pgactivate", &vm_pgactivate},
- {"pgalloc", &vm_pgalloc}, // GONE (now separate dma,high,normal)
- {"pgalloc_dma", &vm_pgalloc_dma},
- {"pgalloc_high", &vm_pgalloc_high},
- {"pgalloc_normal", &vm_pgalloc_normal},
- {"pgdeactivate", &vm_pgdeactivate},
- {"pgfault", &vm_pgfault},
- {"pgfree", &vm_pgfree},
- {"pginodesteal", &vm_pginodesteal},
- {"pgmajfault", &vm_pgmajfault},
- {"pgpgin", &vm_pgpgin}, // important
- {"pgpgout", &vm_pgpgout}, // important
- {"pgrefill", &vm_pgrefill}, // GONE (now separate dma,high,normal)
- {"pgrefill_dma", &vm_pgrefill_dma},
- {"pgrefill_high", &vm_pgrefill_high},
- {"pgrefill_normal", &vm_pgrefill_normal},
- {"pgrotated", &vm_pgrotated},
- {"pgscan", &vm_pgscan}, // GONE (now separate direct,kswapd and dma,high,normal)
- {"pgscan_direct_dma", &vm_pgscan_direct_dma},
- {"pgscan_direct_high", &vm_pgscan_direct_high},
- {"pgscan_direct_normal",&vm_pgscan_direct_normal},
- {"pgscan_kswapd_dma", &vm_pgscan_kswapd_dma},
- {"pgscan_kswapd_high", &vm_pgscan_kswapd_high},
- {"pgscan_kswapd_normal",&vm_pgscan_kswapd_normal},
- {"pgsteal", &vm_pgsteal}, // GONE (now separate dma,high,normal)
- {"pgsteal_dma", &vm_pgsteal_dma},
- {"pgsteal_high", &vm_pgsteal_high},
- {"pgsteal_normal", &vm_pgsteal_normal},
- {"pswpin", &vm_pswpin}, // important
- {"pswpout", &vm_pswpout}, // important
- {"slabs_scanned", &vm_slabs_scanned},
+ VM_TABENTRY(allocstall),
+ VM_TABENTRY(kswapd_inodesteal),
+ VM_TABENTRY(kswapd_steal),
+ VM_TABENTRY(nr_dirty),
+ VM_TABENTRY(nr_mapped),
+ VM_TABENTRY(nr_page_table_pages),
+ VM_TABENTRY(nr_pagecache),
+ VM_TABENTRY(nr_reverse_maps),
+ VM_TABENTRY(nr_slab),
+ VM_TABENTRY(nr_unstable),
+ VM_TABENTRY(nr_writeback),
+ VM_TABENTRY(pageoutrun),
+ VM_TABENTRY(pgactivate),
+ VM_TABENTRY(pgalloc),
+ VM_TABENTRY(pgalloc_dma),
+ VM_TABENTRY(pgalloc_high),
+ VM_TABENTRY(pgalloc_normal),
+ VM_TABENTRY(pgdeactivate),
+ VM_TABENTRY(pgfault),
+ VM_TABENTRY(pgfree),
+ VM_TABENTRY(pginodesteal),
+ VM_TABENTRY(pgmajfault),
+ VM_TABENTRY(pgpgin),
+ VM_TABENTRY(pgpgout),
+ VM_TABENTRY(pgrefill),
+ VM_TABENTRY(pgrefill_dma),
+ VM_TABENTRY(pgrefill_high),
+ VM_TABENTRY(pgrefill_normal),
+ VM_TABENTRY(pgrotated),
+ VM_TABENTRY(pgscan),
+ VM_TABENTRY(pgscan_direct_dma),
+ VM_TABENTRY(pgscan_direct_high),
+ VM_TABENTRY(pgscan_direct_normal),
+ VM_TABENTRY(pgscan_kswapd_dma),
+ VM_TABENTRY(pgscan_kswapd_high),
+ VM_TABENTRY(pgscan_kswapd_normal),
+ VM_TABENTRY(pgsteal),
+ VM_TABENTRY(pgsteal_dma),
+ VM_TABENTRY(pgsteal_high),
+ VM_TABENTRY(pgsteal_normal),
+ VM_TABENTRY(pswpin),
+ VM_TABENTRY(pswpout),
+ VM_TABENTRY(slabs_scanned)
};
const int vm_table_count = sizeof(vm_table)/sizeof(vm_table_struct);
@@ -741,7 +744,10 @@
);
head = tail+1;
if(!found) goto nextline;
- *(found->slot) = strtoul(head,&tail,10);
+ if (found->sz == sizeof(unsigned long long))
+ *((unsigned long long *) found->slot) = strtoull(head,&tail,10);
+ else
+ *((unsigned long *) found->slot) = strtoul(head,&tail,10);
nextline:
//if(found) fprintf(stderr,"%s=%d\n",found->name,*(found->slot));
--- procps-3.2.7/vmstat.c.kzak 2006-08-04 10:52:38.000000000 +0200
+++ procps-3.2.7/vmstat.c 2006-08-04 12:05:49.000000000 +0200
@@ -180,7 +180,7 @@
unsigned int running,blocked,dummy_1,dummy_2;
jiff cpu_use[2], cpu_nic[2], cpu_sys[2], cpu_idl[2], cpu_iow[2], cpu_xxx[2], cpu_yyy[2], cpu_zzz[2];
jiff duse, dsys, didl, diow, dstl, Div, divo2;
- unsigned long pgpgin[2], pgpgout[2], pswpin[2], pswpout[2];
+ unsigned long long pgpgin[2], pgpgout[2], pswpin[2], pswpout[2];
unsigned int intr[2], ctxt[2];
unsigned int sleep_half;
unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul;
@@ -509,7 +509,7 @@
static void sum_format(void) {
unsigned int running, blocked, btime, processes;
jiff cpu_use, cpu_nic, cpu_sys, cpu_idl, cpu_iow, cpu_xxx, cpu_yyy, cpu_zzz;
- unsigned long pgpgin, pgpgout, pswpin, pswpout;
+ unsigned long long pgpgin, pgpgout, pswpin, pswpout;
unsigned int intr, ctxt;
meminfo();
@@ -539,10 +539,10 @@
printf("%13Lu IRQ cpu ticks\n", cpu_xxx);
printf("%13Lu softirq cpu ticks\n", cpu_yyy);
printf("%13Lu stolen cpu ticks\n", cpu_zzz);
- printf("%13lu pages paged in\n", pgpgin);
- printf("%13lu pages paged out\n", pgpgout);
- printf("%13lu pages swapped in\n", pswpin);
- printf("%13lu pages swapped out\n", pswpout);
+ printf("%13llu pages paged in\n", pgpgin);
+ printf("%13llu pages paged out\n", pgpgout);
+ printf("%13llu pages swapped in\n", pswpin);
+ printf("%13llu pages swapped out\n", pswpout);
printf("%13u interrupts\n", intr);
printf("%13u CPU context switches\n", ctxt);
printf("%13u boot time\n", btime);
@@ -554,7 +554,7 @@
static void fork_format(void) {
unsigned int running, blocked, btime, processes;
jiff cpu_use, cpu_nic, cpu_sys, cpu_idl, cpu_iow, cpu_xxx, cpu_yyy, cpu_zzz;
- unsigned long pgpgin, pgpgout, pswpin, pswpout;
+ unsigned long long pgpgin, pgpgout, pswpin, pswpout;
unsigned int intr, ctxt;
getstat(&cpu_use, &cpu_nic, &cpu_sys, &cpu_idl,
@@ -1,22 +0,0 @@
diff -up procps-3.2.7/vmstat.8.timestamp procps-3.2.7/vmstat.8
--- procps-3.2.7/vmstat.8.timestamp 2009-02-03 12:32:27.000000000 +0100
+++ procps-3.2.7/vmstat.8 2009-02-03 12:34:37.000000000 +0100
@@ -8,6 +8,7 @@ vmstat \- Report virtual memory statisti
.B vmstat
.RB [ "\-a" ]
.RB [ "\-n" ]
+.RB [ "\-t" ]
.RI [ delay " [ " count ]]
.br
.B vmstat
@@ -43,7 +44,9 @@ equivalent to the total number of tasks
is represented by one or more tasks, depending on thread usage.
This display does not repeat.
.PP
-The \fB-m\fP displays slabinfo.
+The \fB-t\fP switch adds timestamp to the output.
+.PP
+The \fB-m\fP switch displays slabinfo.
.PP
The \fB-n\fP switch causes the header to be displayed only once rather than periodically.
.PP
@@ -1,117 +0,0 @@
--- procps-3.2.7/vmstat.c 2008-12-11 22:11:30.042532106 -0500
+++ procps-3.2.7/vmstat.c.timestamp 2008-12-11 22:08:11.553529883 -0500
@@ -25,6 +25,7 @@
#include <sys/ioctl.h>
#include <sys/dir.h>
#include <dirent.h>
+#include <time.h>
#include "proc/sysinfo.h"
#include "proc/version.h"
@@ -56,6 +57,7 @@
static unsigned int height; // window height
static unsigned int moreheaders=TRUE;
+static unsigned int showtimestamp=FALSE;
/////////////////////////////////////////////////////////////////////////
@@ -71,6 +73,7 @@
fprintf(stderr," -p prints disk partition statistics\n");
fprintf(stderr," -s prints vm table\n");
fprintf(stderr," -m prints slabinfo\n");
+ fprintf(stderr," -t add timestamp to output\n");
fprintf(stderr," -S unit size\n");
fprintf(stderr," delay is the delay between updates in seconds. \n");
fprintf(stderr," unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)\n");
@@ -150,7 +153,11 @@
////////////////////////////////////////////////////////////////////////////
static void new_header(void){
- printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\n");
+ if(!showtimestamp){
+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\n");
+ } else {
+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ ---timestamp---\n");
+ }
printf(
"%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n",
"r","b",
@@ -173,7 +180,7 @@
////////////////////////////////////////////////////////////////////////////
static void new_format(void) {
- const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
+ const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\t%s\n";
unsigned int tog=0; /* toggle switch for cleaner code */
unsigned int i;
unsigned int hz = Hertz;
@@ -185,6 +192,10 @@
unsigned int sleep_half;
unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul;
int debt = 0; // handle idle ticks running backwards
+ struct tm *tm_ptr;
+ time_t the_time;
+ char timebuf[32];
+ timebuf[0] = '\0';
sleep_half=(sleep_time/2);
new_header();
@@ -196,6 +207,13 @@
&running,&blocked,
&dummy_1, &dummy_2);
+ if (showtimestamp)
+ {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", tm_ptr);
+ }
+
duse= *cpu_use + *cpu_nic;
dsys= *cpu_sys + *cpu_xxx + *cpu_yyy;
didl= *cpu_idl;
@@ -218,7 +236,8 @@
(unsigned)( (100*dsys + divo2) / Div ),
(unsigned)( (100*didl + divo2) / Div ),
(unsigned)( (100*diow + divo2) / Div ),
- (unsigned)( (100*dstl + divo2) / Div )
+ (unsigned)( (100*dstl + divo2) / Div ),
+ timebuf
);
for(i=1;i<num_updates;i++) { /* \\\\\\\\\\\\\\\\\\\\ main loop ////////////////// */
@@ -234,6 +253,13 @@
&running,&blocked,
&dummy_1,&dummy_2);
+ if (showtimestamp)
+ {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", tm_ptr);
+ }
+
duse= cpu_use[tog]-cpu_use[!tog] + cpu_nic[tog]-cpu_nic[!tog];
dsys= cpu_sys[tog]-cpu_sys[!tog] + cpu_xxx[tog]-cpu_xxx[!tog] + cpu_yyy[tog]-cpu_yyy[!tog];
didl= cpu_idl[tog]-cpu_idl[!tog];
@@ -267,7 +293,8 @@
(unsigned)( (100*dsys+divo2)/Div ), /*sy*/
(unsigned)( (100*didl+divo2)/Div ), /*id*/
(unsigned)( (100*diow+divo2)/Div ), //wa
- (unsigned)( (100*dstl+divo2)/Div ) //st
+ (unsigned)( (100*dstl+divo2)/Div ), //st
+ timebuf /* timestamp */
);
}
}
@@ -641,6 +668,9 @@
case 's':
statMode |= VMSUMSTAT;
break;
+ case 't':
+ showtimestamp=TRUE;
+ break;
default:
/* no other aguments defined yet. */
usage();
@@ -1,16 +0,0 @@
--- procps-3.2.7/w.c.kzak 2007-04-02 23:58:30.000000000 +0200
+++ procps-3.2.7/w.c 2007-04-03 00:09:15.000000000 +0200
@@ -149,11 +149,11 @@
const proc_t *restrict const tmp = *pptr;
if(unlikely(tmp->tgid == u->ut_pid)) {
*found_utpid = 1;
- best = tmp;
+ if (!best)
+ best = tmp;
}
if(tmp->tty != line) continue;
(*jcpu) += tmp->utime + tmp->stime;
- secondbest = tmp;
/* same time-logic here as for "best" below */
if(! (secondbest && tmp->start_time <= secondbest->start_time) ){
secondbest = tmp;
@@ -1,139 +0,0 @@
diff -u procps-3.2.7/Makefile procps/Makefile
--- procps-3.2.7/Makefile 2007-01-16 17:24:49.000000000 +0100
+++ procps/Makefile 2007-01-16 17:29:27.000000000 +0100
@@ -67,7 +67,7 @@
# plus the top-level Makefile to make it work stand-alone.
_TARFILES := Makefile
-CURSES := -lncurses
+CURSES := -lncursesw
# This seems about right for the dynamic library stuff.
# Something like this is probably needed to make the SE Linux
diff -u procps-3.2.7/watch.c procps/watch.c
--- procps-3.2.7/watch.c 2007-01-16 17:24:49.000000000 +0100
+++ procps/watch.c 2007-01-16 18:06:57.000000000 +0100
@@ -28,6 +28,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <wchar.h>
+#include <wctype.h>
#ifdef FORCE_8BIT
#undef isprint
@@ -137,6 +139,27 @@
}
}
+static wint_t
+readwc(FILE *stream, mbstate_t *mbs)
+{
+ for (;;) {
+ int chr;
+ char c;
+ wchar_t wc;
+ size_t len;
+
+ chr = getc(stream);
+ if (chr == EOF)
+ return WEOF;
+ c = chr;
+ len = mbrtowc(&wc, &c, 1, mbs);
+ if (len == (size_t)-1)
+ memset(mbs, 0, sizeof(*mbs));
+ else if (len != (size_t)-2)
+ return wc;
+ }
+}
+
int
main(int argc, char *argv[])
{
@@ -243,6 +266,7 @@
FILE *p;
int x, y;
int oldeolseen = 1;
+ mbstate_t mbs;
if (screen_size_changed) {
get_terminal_size();
@@ -276,49 +300,63 @@
do_exit(2);
}
+ memset(&mbs, 0, sizeof(mbs));
for (y = show_title; y < height; y++) {
int eolseen = 0, tabpending = 0;
for (x = 0; x < width; x++) {
- int c = ' ';
- int attr = 0;
+ wint_t c = L' ';
+ int attr = 0, c_width;
+ cchar_t cc;
+ wchar_t wstr[2];
if (!eolseen) {
/* if there is a tab pending, just spit spaces until the
next stop instead of reading characters */
if (!tabpending)
do
- c = getc(p);
- while (c != EOF && !isprint(c)
- && c != '\n'
- && c != '\t');
- if (c == '\n')
+ c = readwc(p, &mbs);
+ while (c != WEOF && !iswprint(c)
+ && c != L'\n'
+ && c != L'\t');
+ if (c == L'\n')
if (!oldeolseen && x == 0) {
x = -1;
continue;
} else
eolseen = 1;
- else if (c == '\t')
+ else if (c == L'\t')
tabpending = 1;
- if (c == EOF || c == '\n' || c == '\t')
- c = ' ';
+ if (c == WEOF || c == L'\n' || c == L'\t')
+ c = L' ';
if (tabpending && (((x + 1) % 8) == 0))
tabpending = 0;
}
+ wstr[0] = c;
+ wstr[1] = 0;
+ setcchar (&cc, wstr, 0, 0, NULL);
move(y, x);
if (option_differences) {
- chtype oldch = inch();
- char oldc = oldch & A_CHARTEXT;
+ cchar_t oldc;
+ wchar_t oldwstr[2];
+ attr_t attrs;
+ short colors;
+
+ in_wch(&oldc);
+ getcchar(&oldc, oldwstr, &attrs, &colors, NULL);
attr = !first_screen
- && ((char)c != oldc
+ && (wstr[0] != oldwstr[0]
||
(option_differences_cumulative
- && (oldch & A_ATTRIBUTES)));
+ && attrs));
}
if (attr)
standout();
- addch(c);
+ add_wch(&cc);
if (attr)
standend();
+ c_width = wcwidth(c);
+ if (c_width > 1)
+ x += c_width - 1;
}
oldeolseen = eolseen;
}

Some files were not shown because too many files have changed in this diff Show More