When applying the vim-patches to vim, gawk is used to parse and process the patches. The gawk code opens each patch in ${WORKDIR}/vimpatches with a call of '(getline tryme < thisfile)'. The problem that arises is that the file handle is NOT closed after reading the patch file. Thus it leaks a file handle for each previously opened patch file -- which vim has a lot of. The gawk info page [1] explicitely states the following: "Similarly, when a file or pipe is opened for output, the file name or command associated with it is remembered by `awk', and subsequent writes to the same file or command are appended to the previous writes. The file or pipe stays open until `awk' exits. This implies that special steps are necessary in order to read the same file again from the beginning, or to rerun a shell command (rather than reading more output from the same command). The `close' function makes these things possible: close(FILENAME) or: close(COMMAND)" While that vim.eclass gawk code may work on some platforms it may (and will) not work on others. For example on NetBSD this will trigger the following: [...] 7.1.077: src/syntax.c src/version.c 7.1.078: src/gui.cgawk: cmd. line:31: (FILENAME=- FNR=10173) fatal: too many pipes or input files open which makes the emerge die. Anyway, it's not a good coding style to leave unused file handles open It can be fixed very easily by issuing 'close(thisfile)' after the vim-patch file has been processed. A patch that does so (and works) is appended. Best regards, Heiko. [1] http://www.scs.cmu.edu/cgi-bin/info2www?(gawk.info)Close%20Files%20And%20Pipes Reproducible: Always Steps to Reproduce: 1.emerge vim-core / vim / gvim 2. 3. Actual Results: gawk fails to process the vim-patches after several patch files with the following eror message: [...] 7.1.077: src/syntax.c src/version.c 7.1.078: src/gui.cgawk: cmd. line:31: (FILENAME=- FNR=10173) fatal: too many pipes or input files open Expected Results: Continue patching.
Created attachment 140536 [details, diff] patch to close the file handles This patch closes the file handles gawk has finished processing.
Fixed. Thanks for reporting :)