Re: fix markup in glob(7)

2023-05-29 Thread Jason McIntyre
On Tue, May 30, 2023 at 12:06:37AM -0400, aisha wrote:
> Hi,
> 
>   Was teaching glob(7) syntax to my brother and noticed that the markup for 
> [...] character classes was broken in HTML format from mandoc. Attached patch 
> renders the correct HTML.
> 
> Sidenote, mdoc(7) says 'Li' is deprecated but none of the suggested 
> replacements were working in this context.
> 
> OK?
> 
> Cheers,
> Aisha
> 

hi.

so your diff is technically correct, i think, so ok to commit it.
jmc

> diff --git a/share/man/man7/glob.7 b/share/man/man7/glob.7
> index 037cb52e438..443ef3c7b6f 100644
> --- a/share/man/man7/glob.7
> +++ b/share/man/man7/glob.7
> @@ -85,9 +85,9 @@ and
>  stands for the list of all characters belonging to that class.
>  Supported character classes:
>  .Bl -column "xdigit" "xdigit" "xdigit" -offset indent
> -.It Li "alnum" Ta "cntrl" Ta "lower" Ta "space"
> -.It Li "alpha" Ta "digit" Ta "print" Ta "upper"
> -.It Li "blank" Ta "graph" Ta "punct" Ta "xdigit"
> +.It Li "alnum" Ta Li "cntrl" Ta Li "lower" Ta Li "space"
> +.It Li "alpha" Ta Li "digit" Ta Li "print" Ta Li "upper"
> +.It Li "blank" Ta Li "graph" Ta Li "punct" Ta Li "xdigit"
>  .El
>  .Pp
>  These match characters using the macros specified in
> 



fix markup in glob(7)

2023-05-29 Thread aisha
Hi,

  Was teaching glob(7) syntax to my brother and noticed that the markup for 
[...] character classes was broken in HTML format from mandoc. Attached patch 
renders the correct HTML.

Sidenote, mdoc(7) says 'Li' is deprecated but none of the suggested 
replacements were working in this context.

OK?

Cheers,
Aisha

diff --git a/share/man/man7/glob.7 b/share/man/man7/glob.7
index 037cb52e438..443ef3c7b6f 100644
--- a/share/man/man7/glob.7
+++ b/share/man/man7/glob.7
@@ -85,9 +85,9 @@ and
 stands for the list of all characters belonging to that class.
 Supported character classes:
 .Bl -column "xdigit" "xdigit" "xdigit" -offset indent
-.It Li "alnum" Ta "cntrl" Ta "lower" Ta "space"
-.It Li "alpha" Ta "digit" Ta "print" Ta "upper"
-.It Li "blank" Ta "graph" Ta "punct" Ta "xdigit"
+.It Li "alnum" Ta Li "cntrl" Ta Li "lower" Ta Li "space"
+.It Li "alpha" Ta Li "digit" Ta Li "print" Ta Li "upper"
+.It Li "blank" Ta Li "graph" Ta Li "punct" Ta Li "xdigit"
 .El
 .Pp
 These match characters using the macros specified in



Re: dpb.1: Reference sections properly

2023-05-29 Thread A Tammy
OK aisha@

On 5/29/23 12:21, Josiah Frentsos wrote:
> Index: dpb.1
> ===
> RCS file: /cvs/src/share/man/man1/dpb.1,v
> retrieving revision 1.32
> diff -u -p -r1.32 dpb.1
> --- dpb.1 29 May 2023 09:05:24 -  1.32
> +++ dpb.1 29 May 2023 16:19:45 -
> @@ -66,7 +66,7 @@ for example setups).
>  .Nm
>  will then change its identity to different users as needed.
>  See
> -.Sq THE SECURITY MODEL OF DPB
> +.Sx THE SECURITY MODEL OF DPB
>  for details.
>  .Pp
>  .Nm
> @@ -518,7 +518,7 @@ It will go straight to build and package
>  Defaults to 120 seconds.
>  .It squiggles=n
>  Number of squiggles on this host (see
> -.Sq the squiggle heuristics
> +.Sx THE SQUIGGLE HEURISTICS
>  below).
>  Defaults to 1 squiggle for hosts with 4 jobs or more, 0.7 for hosts with 
> more than 1 job,
>  0 for single job hosts.
>



Re: Bail out on "id -R user"

2023-05-29 Thread Lucas
Ping.

> According to both usage() and id.1, "id -R" doesn't accept any
> positional arguments. This diff makes program behave like that.


diff refs/heads/master refs/heads/id-R-usage
commit - 55055d619d36cc45f8c6891404c51cd405214e86
commit + 214ec9c042895b8482378b6ee43530ce4ffe9e21
blob - 30e2c58e088b69dba98577693e37dd961b4eadc4
blob + 1f4b678597065fb4243f660b4f66040021c56895
--- usr.bin/id/id.c
+++ usr.bin/id/id.c
@@ -128,6 +128,8 @@ main(int argc, char *argv[])
usage();
 
if (Rflag) {
+   if (argc != 0)
+   usage();
printf("%d\n", getrtable());
exit(0);
}



Re: ksh, test: test -t file descriptor isn't optional

2023-05-29 Thread Lucas
Ping.

> Hi tech@,
> 
> Both test.1 and ksh.1 (under the non-POSIX compatibility flag) state
> that `test -t` will default to test whether fd 1 is a TTY if the
> argument is omitted. This isn't the case, and both treat `-t` as the
> equivalent of `test -n -t`, ie, test if `-t` is a non-empty string,
> trivially true.
> 
> It's easy to see it in `test`: it exits right away in switch(argc).
> `ksh` is a bit more difficult to follow: builtins eventually call c_test
> in c_test.c. For `test -t`, c_test will be called with wp being "test",
> "-t". It'll eventually call test_parse, with the test environment set
> with
> 
>   te.pos.wp = wp + 1;
>   te.wp_end = wp + argc;
> 
> For this particular case, argc is 2. Bearing that in mind, test_parse
> will make a call stack of test_aexpr -> test_oexpr -> test_nexpr ->
> test_primary. The first 2 ifs are skipped (asuming no TEF_ERROR is set)
> and the next if, which would handle `test -t` gracefully, isn't entered:
> one of the && operands, >pos.wp[1] < te->wp_end, is false.
> Afterwards, `-t` is evaled as TO_SNTZE, ie if it's a non-empty string.
> 
> The following diff amends the manpages, removing the "file descriptor
> is optional" parts, and removes the unused machinery of bin/ksh/c_test.c
> to deal with an optional argument in `test -t`, together with a small
> rewrite in test_eval TO_FILTT case, as it was a bit too difficult for me
> to read: it seems that, for legacy reason (haven't looked at the code
> history), opnd1 could be NULL for TO_FILTT, the only test with such
> behaviour. My understanding is that ptest_getopnd avoids that by
> returning "1". So, opnd1 can't be NULL. bi_getn writes to res, but took
> me a while to understand that looking only at the conditional call of
> bi_getn in the if condition. Finally, for some reason, is opnd1 managed
> to be NULL, isatty(0) is called. I believe that the intention was to do
> 
>   res = opnd1 ? isatty(res) : 0;
> 
> instead. I think the proposed rewrite is easier to follow.
> 
> Regress is happy, although nothing in there tests `test -t` or `test -t
> n`. Existing scripts shouldn't break with this change: `test -t` will
> keep being true, whether fd 1 is a TTY or not. The diff can be further
> split on man changes and code changes if needed.
> 
> btw, the easy test for `test -t` being wrong, whether under POSIX compat
> or not, is
> 
>   $ test -t 1; echo $? # 1 is TTY in an interactive session
>   0
>   $ test -t 1 >&-; echo $? # 1 isn't a TTY because it's closed
>   1
>   $ test -t >&-; echo $?
>   0


diff refs/heads/master refs/heads/ksh-t-fd
commit - 55055d619d36cc45f8c6891404c51cd405214e86
commit + 00fa44f8caccc78154e093b5fa719e392716b81e
blob - 7038a52bfa432d515d9683187930407c4d6bd6d5
blob + db16b71a9b64afb7047803c65ec620f03e18e42d
--- bin/ksh/c_test.c
+++ bin/ksh/c_test.c
@@ -156,12 +156,6 @@ c_test(char **wp)
}
if (argc == 1) {
opnd1 = (*te.getopnd)(, TO_NONOP, 1);
-   /* Historically, -t by itself test if fd 1
-* is a file descriptor, but POSIX says its
-* a string test...
-*/
-   if (!Flag(FPOSIX) && strcmp(opnd1, "-t") == 0)
-   break;
res = (*te.eval)(, TO_STNZE, opnd1,
NULL, 1);
if (invert & 1)
@@ -271,14 +265,18 @@ test_eval(Test_env *te, Test_op op, const char *opnd1,
case TO_FILGZ: /* -s */
return stat(opnd1, ) == 0 && b1.st_size > 0L;
case TO_FILTT: /* -t */
-   if (opnd1 && !bi_getn(opnd1, )) {
-   te->flags |= TEF_ERROR;
-   res = 0;
-   } else {
-   /* generate error if in FPOSIX mode? */
-   res = isatty(opnd1 ? res : 0);
+   {
+   int s, v;
+
+   s = bi_getn(opnd1, );
+   if (!s) {
+   te->flags |= TEF_ERROR;
+   res = 0;
+   } else {
+   res = isatty(v);
+   }
+   return res;
}
-   return res;
case TO_FILUID: /* -O */
return stat(opnd1, ) == 0 && b1.st_uid == ksheuid;
case TO_FILGID: /* -G */
@@ -527,7 +525,7 @@ ptest_getopnd(Test_env *te, Test_op op, int do_eval)
 ptest_getopnd(Test_env *te, Test_op op, int do_eval)
 {
if (te->pos.wp >= te->wp_end)
-   return op == TO_FILTT ? "1" : NULL;
+   return NULL;
return *te->pos.wp++;
 }
 
blob - cd3bfc3ebf41217b46c69eaff634cd8e9771c425
blob + c8406305e706cff12711bbcb934f13d67f49ebdf
--- bin/ksh/ksh.1
+++ 

dpb.1: Reference sections properly

2023-05-29 Thread Josiah Frentsos
Index: dpb.1
===
RCS file: /cvs/src/share/man/man1/dpb.1,v
retrieving revision 1.32
diff -u -p -r1.32 dpb.1
--- dpb.1   29 May 2023 09:05:24 -  1.32
+++ dpb.1   29 May 2023 16:19:45 -
@@ -66,7 +66,7 @@ for example setups).
 .Nm
 will then change its identity to different users as needed.
 See
-.Sq THE SECURITY MODEL OF DPB
+.Sx THE SECURITY MODEL OF DPB
 for details.
 .Pp
 .Nm
@@ -518,7 +518,7 @@ It will go straight to build and package
 Defaults to 120 seconds.
 .It squiggles=n
 Number of squiggles on this host (see
-.Sq the squiggle heuristics
+.Sx THE SQUIGGLE HEURISTICS
 below).
 Defaults to 1 squiggle for hosts with 4 jobs or more, 0.7 for hosts with more 
than 1 job,
 0 for single job hosts.