Hello Martin.

Martin Neitzel wrote in <201909232142.x8nlg2gv013...@oker.escape.de>:
 |Steffen Nurpmeso <stef...@sdaoden.eu> wrote:
 |>|$ bash ../mk/make-rules.sh su/*.c
 |>|(...previous lines omitted...)
 |>|su-018.o: $(SU_SRCDIR)su/utf.cawk: su/utf.c makes too many open files
 |>| input record number 18, file
 |>| source line number 74
 |> 
 |> Ah!  Of course, i had totally forgotten about this!  The Apple awk
 |> leaks file descriptors, 
 |
 |Maybe rather your *script* is leaking the file descriptors.  I see you
 |are are merrily opening new files through
 |
 | po_i = getline < farr[no]
 |
 |without ever closing them again, so they accumulate.
 |
 |I suggest to add the close into the EOF check following right after
 |the getline:
 |
 |        if(po_i == 0) {
 |     close(farr[no]
 |            break
 |}
 |
 |(I grew up on unix systems with the "20 open files per process" limit,
 |so I quickly got into the habit of properly closing my files again
 |in awk, too.)

Interesting.  The close()s have been removed in

  commit 51ed1c81
  Author:     Steffen Nurpmeso <stef...@sdaoden.eu>
  AuthorDate: 2019-04-16 00:22:31 +0200
  Commit:     Steffen Nurpmeso <stef...@sdaoden.eu>
  CommitDate: 2019-04-16 20:05:11 +0200

      mk/make-rules.sh: unroll basename/dirname (Alexander Harm)..

      Homebrew ran into link errors, and Alexander correctly pointed out
      that the Apple /usr/bin/awk did not close file descriptors opened
      in getline calls, that is: explicit close() is not honoured.
      Thus hack the same stuff via regex, which should get us going there

But i see that the "Parse file loop" loop does not close the fd
either, mess!  Will fix tomorrow!  Thanks for the report!!

Ciao, and good night,

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

Reply via email to