Linux Documentation
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Linux Documentation <linux-doc@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>
Subject: Re: make mandocs: subdirectories scanned
Date: Sat, 8 Nov 2025 15:11:13 -0800	[thread overview]
Message-ID: <a98ff265-ff07-41e2-9595-618dde42bc52@infradead.org> (raw)
In-Reply-To: <20251109000825.0bb65270@foz.lan>



On 11/8/25 3:08 PM, Mauro Carvalho Chehab wrote:
> Em Sat, 8 Nov 2025 14:50:35 -0800
> Randy Dunlap <rdunlap@infradead.org> escreveu:
> 
>> Hi,
>>
>> I just hit a problem that I haven't encountered in the past.
>>
>> I always use O=subdir to build test kernels, where subdir is
>> at the top level of the kernel source tree.
>> (I just found this maybe because I haven't been doing a lot of
>> kernel builds lately.)
>>
>> This causes 'make mandocs' to recurse continuously because
>> subdir/source is a symbolic link to ".." (top level of kernel
>> tree) and kernel-doc finds all of the (same) source files again
>> there.
>>
>> I first discovered this with a subdir named ARM, for arch/arm/
>> builds. I tried renaming it .ARM but same result. Then I tried
>> a subdir name of "snap" because it is in the .gitignore file.
>>
>> All of these have the same result. Here is an example of the
>> output:
>>
>> Warning: ../snap/source/snap/source/snap/source/drivers/net/ethernet/freescale/gianfar.h:1105 struct member 'rstat' not described in 'gfar_priv_grp'
>> Warning: ../snap/source/snap/source/snap/source/drivers/net/ethernet/freescale/gianfar.h:1105 struct member 'num_tx_queues' not described in 'gfar_priv_grp'
>> Warning: ../snap/source/snap/source/snap/source/drivers/net/ethernet/freescale/gianfar.h:1105 struct member 'tx_bit_map' not described in 'gfar_priv_grp'
>> Warning: ../snap/source/snap/source/snap/source/drivers/net/ethernet/freescale/gianfar.h:1105 struct member 'num_rx_queues' not described in 'gfar_priv_grp'
>> Warning: ../snap/source/snap/source/snap/source/drivers/net/ethernet/freescale/gianfar.h:1105 struct member 'rx_bit_map' not described in 'gfar_priv_grp'
>> Warning: ../snap/source/snap/source/snap/source/drivers/net/ethernet/freescale/fec_mpc52xx.c:698 function parameter 'may_sleep' not described in 'mpc52xx_fec_stop'
>>
>> Would it be reasonable to have kernel-doc not follow symbolic links?
>>
>> Any other suggestions (other than not using local [in the kernel source tree]
>> build subdirectories)?
>>
>> thanks.
> 
> The logic which parses the directory structure is at
> scripts/lib/kdoc/kdoc_files.py:
> 
>     def _parse_dir(self, dirname):
>         """Internal function to parse files recursively"""
> 
>         with os.scandir(dirname) as obj:
>             for entry in obj:
>                 name = os.path.join(dirname, entry.name)
> 
>                 if entry.is_dir():
>                     yield from self._parse_dir(name)
> 
>                 if not entry.is_file():
>                     continue
> 
>                 basename = os.path.basename(name)
> 
>                 if not basename.endswith(self.extensions):
>                     continue
> 
>                 yield name
> 
> The recursive logic is at:
> 
>                 if entry.is_dir():
>                     yield from self._parse_dir(name)
> 
> It should be easy to change the above to check for symlinks with either:
> 
> +	if entry.is_symlink():
> +	    continue
> +
>         if entry.is_dir():
>             yield from self._parse_dir(name)
> 
> (this would ignore symlinks on files - not sure if this is the best
> strategy)
> 
> or:
> 
>                 if entry.is_dir():
> +		    if entry.is_symlink():
> +		        continue
> +
>                     yield from self._parse_dir(name)
> 
> Alternatively, you can, instead, do:
> 
> -               if entry.is_dir():
> +               if entry.is_dir(follow_symlinks=False):
>                     yield from self._parse_dir(name)
> 
> which should prevent it to follow symlinks.
> 
> I would try the last one first.
> 
> It is likely easier if you write such patch, as you have already a setup
> where you can test it.

Sure, I'll test that today (Saturday) or Sunday.

Thanks.

-- 
~Randy


  reply	other threads:[~2025-11-08 23:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-08 22:50 make mandocs: subdirectories scanned Randy Dunlap
2025-11-08 23:08 ` Mauro Carvalho Chehab
2025-11-08 23:11   ` Randy Dunlap [this message]
2025-11-09  5:00   ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a98ff265-ff07-41e2-9595-618dde42bc52@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox