Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: maxime.chevallier@bootlin.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, bobbyeshleman@gmail.com,
	donald.hunter@gmail.com, horms@kernel.org, shuah@kernel.org,
	matttbe@kernel.org, sdf@fomichev.me, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH RESEND net-next] tools: ynl: Fix out-of-tree build for ynltool
Date: Fri, 11 Sep 2026 16:57:23 +0000	[thread overview]
Message-ID: <178914584334.219967.14649627608959886945@kernel.org> (raw)
In-Reply-To: <20260910165451.1027541-1-maxime.chevallier@bootlin.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 2 · Low: 0

- [Medium] Incomplete $(OUTPUT) plumbing in
  tools/net/ynl/ynltool/Makefile: the patched rule `$(OUTPUT)%.o: %.c`…
- [Medium] The `install` target in tools/net/ynl/ynltool/Makefile (lines
  49-50) reuses `$(YNLTOOL)` as the destination file name: `$(INSTALL)…

--

tools: ynl: Fix out-of-tree build for ynltool

This changes the object compile rule in tools/net/ynl/ynltool/Makefile from
%.o: %.c to $(OUTPUT)%.o: %.c so that the pattern rule matches the
$(OUTPUT)-prefixed object names already used in OBJS.  This unblocks
make -C tools/net/ynl/ynltool O=<dir>, which previously stopped with
"No rule to make target '/tmp/o1/json_writer.o'".

Closes: https://lore.kernel.org/all/aqCyWQxqKDuQnZYR@devvm29614.prn0.facebook.com/

> diff --git a/tools/net/ynl/ynltool/Makefile b/tools/net/ynl/ynltool/Makefile
> index b8c67cdb4fdf0..1053e7606c86c 100644
> --- a/tools/net/ynl/ynltool/Makefile
> +++ b/tools/net/ynl/ynltool/Makefile
> @@ -31,7 +31,7 @@ $(YNLTOOL): ../libynl.a $(OBJS)
>  	$(Q)echo -e "\tLINK $@"
>  	$(Q)$(CC) $(CFLAGS) -o $@ $(OBJS) ../libynl.a -lm
>  
> -%.o: %.c ../libynl.a
> +$(OUTPUT)%.o: %.c ../libynl.a
>  	$(Q)echo -e "\tCC $@"
>  	$(Q)$(COMPILE.c) -MMD -c -o $@ $<

[Severity: Medium]
Since -MMD derives the depfile name from the -o argument, does this rule
now write the dependency files into $(OUTPUT) as well, i.e. /tmp/o1/foo.d
next to /tmp/o1/foo.o?

The consumer side of that convention still globs the source directory only:

tools/net/ynl/ynltool/Makefile:
	include $(wildcard *.d)

With OUTPUT set to an absolute path ending in '/' (tools/scripts/Makefile.include
defines OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) when O= is given
on the command line), can *.d ever match /tmp/o1/*.d?  If it cannot, are
header dependencies simply untracked for the O= builds this patch enables?

The only remaining prerequisites of $(OUTPUT)%.o are the .c file and
../libynl.a, and that archive has no prerequisites of its own:

tools/net/ynl/ynltool/Makefile:
	../libynl.a:
		$(Q)$(MAKE) -C ../

so once ../libynl.a exists make treats it as up to date.  Does editing a
header under ../lib, or regenerating ../generated, then leave a stale
$(OUTPUT)foo.o to be re-linked into $(OUTPUT)ynltool?

Related, the clean recipe only touches the source directory:

tools/net/ynl/ynltool/Makefile:
	clean:
		rm -f *.o *.d *~

Is make O=/tmp/o1 clean a no-op for the artifacts the new rule produces,
leaving no way to force the rebuild?  Note distclean just below it is
$(OUTPUT)-aware through $(YNLTOOL).  Would it make sense to change the
include to $(wildcard $(OUTPUT)*.d) and the clean recipe to remove
$(OUTPUT)*.o and $(OUTPUT)*.d in the same patch?

[Severity: Medium]
The commit message says "Now, the O= parameter is correctly accounted for",
but there is another $(OUTPUT) consumer left in this same Makefile:

tools/net/ynl/ynltool/Makefile:
	YNLTOOL := $(OUTPUT)ynltool
	...
	bindir ?= /usr/bin

	install: $(YNLTOOL)
		$(INSTALL) -m 0755 $(YNLTOOL) $(DESTDIR)$(bindir)/$(YNLTOOL)

Since $(YNLTOOL) carries the absolute $(OUTPUT) prefix, does
make -C tools/net/ynl/ynltool O=/tmp/o1 install expand to

	install -m 0755 /tmp/o1/ynltool /usr/bin//tmp/o1/ynltool

and fail with ENOENT because the intermediate directories do not exist?
With a non-empty DESTDIR that happens to contain that nested path, would
the binary instead land somewhere unintended?

Should the destination be $(DESTDIR)$(bindir)/ynltool, or
$(DESTDIR)$(bindir)/$(notdir $(YNLTOOL))?

The same path is reachable from the parent Makefile, which recurses with

tools/net/ynl/Makefile:
	@make -C ynltool install

and a command-line O= is inherited through MAKEFLAGS, so does
make -C tools/net/ynl O=<dir> install fail the same way?

Unrelated to O=, bindir ?= /usr/bin hardcodes the path while the
prefix ?= /usr declared earlier in the same file is never used, whereas the
parent Makefile derives libdir and includedir from $(prefix).  Was the
inconsistency intended?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260910165451.1027541-1-maxime.chevallier%40bootlin.com

      parent reply	other threads:[~2026-09-11 16:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 16:54 [PATCH RESEND net-next] tools: ynl: Fix out-of-tree build for ynltool Maxime Chevallier (Netdev Foundation)
2026-09-10 17:32 ` Nicolai Buchwitz
2026-09-11 16:57 ` netdev-bot+sashiko [this message]

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=178914584334.219967.14649627608959886945@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bobbyeshleman@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=matttbe@kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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