tests: fix main symbol duplication

Submitted by Leonid Bobrov on Feb. 7, 2019, 4:07 p.m.

Details

Message ID 20190207160736.7emuimk56xwki7rk@mazocomp.lan
State Superseded
Headers show
Series "tests: fix main symbol duplication" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Leonid Bobrov Feb. 7, 2019, 4:07 p.m.
From b00351a95d98e4ecc8efe9c7f1e5c56e79fe5f9f Mon Sep 17 00:00:00 2001
From: Leonid Bobrov <mazocomp@disroot.org>
Date: Thu, 7 Feb 2019 18:02:57 +0200
Subject: [PATCH] tests: fix main symbol duplication

So far I got these errors before patching:

libtool: link: cc -o .libs/headers-test -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/headers-test.o tests/headers-protocol-test.o tests/headers-protocol-core-test.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at headers-test.c:53 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/headers-test.c:53)
>>>            tests/headers-test.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a

libtool: link: cc -o .libs/exec-fd-leak-checker -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/exec-fd-leak-checker.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at exec-fd-leak-checker.c:57 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/exec-fd-leak-checker.c:57)
>>>            tests/exec-fd-leak-checker.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a

Makefile.am: error: object 'tests/test-helpers.$(OBJEXT)' created both with libtool and without

libtool: link: cc -o .libs/fixed-benchmark -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/fixed-benchmark.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at fixed-benchmark.c:100 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/fixed-benchmark.c:100)
>>>            tests/fixed-benchmark.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a

This commit fixes all of that.
---
 Makefile.am | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git Makefile.am Makefile.am
index 697c517..cce4d73 100644
--- Makefile.am
+++ Makefile.am
@@ -210,12 +210,16 @@  noinst_PROGRAMS =				\
 	exec-fd-leak-checker			\
 	fixed-benchmark
 
-noinst_LTLIBRARIES += libtest-runner.la
+noinst_LTLIBRARIES +=				\
+	libtest-runner.la			\
+	libtest-helpers.la
+
+libtest_helpers_la_SOURCES = tests/test-helpers.c
+libtest_helpers_la_LIBADD = -lrt -ldl $(FFI_LIBS)
 
 libtest_runner_la_SOURCES =			\
 	tests/test-runner.c			\
 	tests/test-runner.h			\
-	tests/test-helpers.c			\
 	tests/test-compositor.h			\
 	tests/test-compositor.c
 libtest_runner_la_LIBADD =			\
@@ -223,8 +227,7 @@  libtest_runner_la_LIBADD =			\
 	libwayland-util.la			\
 	libwayland-client.la			\
 	libwayland-server.la			\
-	-lrt -ldl $(FFI_LIBS)
-
+	libtest-helpers.la
 
 array_test_SOURCES = tests/array-test.c
 array_test_LDADD = libtest-runner.la
@@ -270,7 +273,6 @@  protocol_logger_test_LDADD = libtest-runner.la
 headers_test_SOURCES = tests/headers-test.c \
 		       tests/headers-protocol-test.c \
 		       tests/headers-protocol-core-test.c
-headers_test_LDADD = libtest-runner.la
 nodist_headers_test_SOURCES =			\
 	protocol/wayland-server-protocol-core.h	\
 	protocol/wayland-client-protocol-core.h
@@ -280,13 +282,12 @@  cpp_compile_test_SOURCES = tests/cpp-compile-test.cpp
 endif
 
 fixed_benchmark_SOURCES = tests/fixed-benchmark.c
-fixed_benchmark_LDADD = libtest-runner.la
 
 os_wrappers_test_SOURCES = tests/os-wrappers-test.c
 os_wrappers_test_LDADD = libtest-runner.la
 
 exec_fd_leak_checker_SOURCES = tests/exec-fd-leak-checker.c
-exec_fd_leak_checker_LDADD = libtest-runner.la
+exec_fd_leak_checker_LDADD = libtest-helpers.la
 
 EXTRA_DIST += tests/scanner-test.sh			\
 	protocol/tests.xml				\

Comments

On Thu, 7 Feb 2019 18:07:36 +0200
Leonid Bobrov <mazocomp@disroot.org> wrote:

> From b00351a95d98e4ecc8efe9c7f1e5c56e79fe5f9f Mon Sep 17 00:00:00 2001
> From: Leonid Bobrov <mazocomp@disroot.org>
> Date: Thu, 7 Feb 2019 18:02:57 +0200
> Subject: [PATCH] tests: fix main symbol duplication

Hi Leonid,

your approach to fix these issues looks good to me, and the commit
message explains everything I could ask for, except for maybe
mentioning that the linker is one from OpenBSD, was it?

Unfortunately it seems the patch is somehow malformed:

git am -3 /home/pq/.claws-mail/imapcache/imap.gmail.com/ppaalanen@gmail.com/lists/wayland-devel/39311
-----------------------------------------------------------------------
Applying: tests: fix main symbol duplication
error: git diff header lacks filename information when removing 1 leading pathname component (line 9)
error: could not build fake ancestor
Patch failed at 0001 tests: fix main symbol duplication

It does not look like it came from git-format-patch.

Could you retry, please?

I guess that you might be sending more patches, therefore it would be
nice to get the workflow in order so I don't have to manually redo
every patch.

Would you consider adding a Signed-off-by as well to show that you
agree to https://developercertificate.org/ too?

S-o-b is mentioned in
https://gitlab.freedesktop.org/wayland/wayland/blob/master/CONTRIBUTING.md#sending-patches .


Thanks,
pq

> 
> So far I got these errors before patching:
> 
> libtool: link: cc -o .libs/headers-test -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/headers-test.o tests/headers-protocol-test.o tests/headers-protocol-core-test.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
> ld: error: duplicate symbol: main
> >>> defined at headers-test.c:53 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/headers-test.c:53)
> >>>            tests/headers-test.o:(main)
> >>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
> >>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a  
> 
> libtool: link: cc -o .libs/exec-fd-leak-checker -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/exec-fd-leak-checker.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
> ld: error: duplicate symbol: main
> >>> defined at exec-fd-leak-checker.c:57 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/exec-fd-leak-checker.c:57)
> >>>            tests/exec-fd-leak-checker.o:(main)
> >>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
> >>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a  
> 
> Makefile.am: error: object 'tests/test-helpers.$(OBJEXT)' created both with libtool and without
> 
> libtool: link: cc -o .libs/fixed-benchmark -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/fixed-benchmark.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
> ld: error: duplicate symbol: main
> >>> defined at fixed-benchmark.c:100 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/fixed-benchmark.c:100)
> >>>            tests/fixed-benchmark.o:(main)
> >>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
> >>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a  
> 
> This commit fixes all of that.
> ---
>  Makefile.am | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git Makefile.am Makefile.am
> index 697c517..cce4d73 100644
> --- Makefile.am
> +++ Makefile.am
> @@ -210,12 +210,16 @@ noinst_PROGRAMS =				\
>  	exec-fd-leak-checker			\
>  	fixed-benchmark
>  
> -noinst_LTLIBRARIES += libtest-runner.la
> +noinst_LTLIBRARIES +=				\
> +	libtest-runner.la			\
> +	libtest-helpers.la
> +
> +libtest_helpers_la_SOURCES = tests/test-helpers.c
> +libtest_helpers_la_LIBADD = -lrt -ldl $(FFI_LIBS)
>  
>  libtest_runner_la_SOURCES =			\
>  	tests/test-runner.c			\
>  	tests/test-runner.h			\
> -	tests/test-helpers.c			\
>  	tests/test-compositor.h			\
>  	tests/test-compositor.c
>  libtest_runner_la_LIBADD =			\
> @@ -223,8 +227,7 @@ libtest_runner_la_LIBADD =			\
>  	libwayland-util.la			\
>  	libwayland-client.la			\
>  	libwayland-server.la			\
> -	-lrt -ldl $(FFI_LIBS)
> -
> +	libtest-helpers.la
>  
>  array_test_SOURCES = tests/array-test.c
>  array_test_LDADD = libtest-runner.la
> @@ -270,7 +273,6 @@ protocol_logger_test_LDADD = libtest-runner.la
>  headers_test_SOURCES = tests/headers-test.c \
>  		       tests/headers-protocol-test.c \
>  		       tests/headers-protocol-core-test.c
> -headers_test_LDADD = libtest-runner.la
>  nodist_headers_test_SOURCES =			\
>  	protocol/wayland-server-protocol-core.h	\
>  	protocol/wayland-client-protocol-core.h
> @@ -280,13 +282,12 @@ cpp_compile_test_SOURCES = tests/cpp-compile-test.cpp
>  endif
>  
>  fixed_benchmark_SOURCES = tests/fixed-benchmark.c
> -fixed_benchmark_LDADD = libtest-runner.la
>  
>  os_wrappers_test_SOURCES = tests/os-wrappers-test.c
>  os_wrappers_test_LDADD = libtest-runner.la
>  
>  exec_fd_leak_checker_SOURCES = tests/exec-fd-leak-checker.c
> -exec_fd_leak_checker_LDADD = libtest-runner.la
> +exec_fd_leak_checker_LDADD = libtest-helpers.la
>  
>  EXTRA_DIST += tests/scanner-test.sh			\
>  	protocol/tests.xml				\
On Fri, Feb 08, 2019 at 12:09:09PM +0200, Pekka Paalanen wrote:
> Hi Leonid,
> 

Hi Pekka,

> your approach to fix these issues looks good to me, and the commit
> message explains everything I could ask for, except for maybe
> mentioning that the linker is one from OpenBSD, was it?
> 
> Unfortunately it seems the patch is somehow malformed:
> 
> git am -3 /home/pq/.claws-mail/imapcache/imap.gmail.com/ppaalanen@gmail.com/lists/wayland-devel/39311
> -----------------------------------------------------------------------
> Applying: tests: fix main symbol duplication
> error: git diff header lacks filename information when removing 1 leading pathname component (line 9)
> error: could not build fake ancestor
> Patch failed at 0001 tests: fix main symbol duplication
> 
> It does not look like it came from git-format-patch.
> 

Weird, because I ran $ git format-patch HEAD~1

> Could you retry, please?
> 
> I guess that you might be sending more patches, therefore it would be
> nice to get the workflow in order so I don't have to manually redo
> every patch.
> 

Yes, I am preparing more patches, trying to divide src/event-loop.c
into src/event-loop-epoll.c and srs/event-loop-kqueue.c

> Would you consider adding a Signed-off-by as well to show that you
> agree to https://developercertificate.org/ too?
> 

I don't know how to do that, besides I have no intention to license code
I submit, so you are completely free to use it.

> S-o-b is mentioned in
> https://gitlab.freedesktop.org/wayland/wayland/blob/master/CONTRIBUTING.md#sending-patches .
> 
> 
> Thanks,
> pq
>
On Fri, 8 Feb 2019 12:23:06 +0200
Leonid Bobrov <mazocomp@disroot.org> wrote:

> On Fri, Feb 08, 2019 at 12:09:09PM +0200, Pekka Paalanen wrote:
> > Hi Leonid,
> >   
> 
> Hi Pekka,
> 
> > your approach to fix these issues looks good to me, and the commit
> > message explains everything I could ask for, except for maybe
> > mentioning that the linker is one from OpenBSD, was it?
> > 
> > Unfortunately it seems the patch is somehow malformed:
> > 
> > git am -3 /home/pq/.claws-mail/imapcache/imap.gmail.com/ppaalanen@gmail.com/lists/wayland-devel/39311
> > -----------------------------------------------------------------------
> > Applying: tests: fix main symbol duplication
> > error: git diff header lacks filename information when removing 1 leading pathname component (line 9)
> > error: could not build fake ancestor
> > Patch failed at 0001 tests: fix main symbol duplication
> > 
> > It does not look like it came from git-format-patch.
> >   
> 
> Weird, because I ran $ git format-patch HEAD~1

Weird indeed. Did you manually edit the patch, or copy & paste it?

The diff line file names are missing the typical a/ and b/ like this:

diff --git a/libweston-desktop/internal.h b/libweston-desktop/internal.h
index 2f2af98c..ce853ba9 100644
--- a/libweston-desktop/internal.h
+++ b/libweston-desktop/internal.h

> > Could you retry, please?
> > 
> > I guess that you might be sending more patches, therefore it would be
> > nice to get the workflow in order so I don't have to manually redo
> > every patch.
> >   
> 
> Yes, I am preparing more patches, trying to divide src/event-loop.c
> into src/event-loop-epoll.c and srs/event-loop-kqueue.c
> 
> > Would you consider adding a Signed-off-by as well to show that you
> > agree to https://developercertificate.org/ too?
> >   
> 
> I don't know how to do that, besides I have no intention to license code
> I submit, so you are completely free to use it.

The way you do that is you put

Signed-off-by: Your Real Name <email@address>

at the end of each commit message. You can check almost any existing
Wayland commit for an example.

If you do not license your code under the very license the project is
using, then we cannot take your contributions at all. No license means
no-one can do anything with it, particularly redistribute it. I once saw
someone say: the copyright law makes no difference between your patch
and the latest Disney movie.

No license: no rights.

"Feel free to use it" is not a license. We really do need a valid
license for all contributions. The way that happens is that people
check the project license (in this case it is duplicated in the top of
almost every source file, and in the COPYING file at the root
directory) and agree to that. Putting your S-o-b in the commit message
is an explicit indicator that you agree, but also the fact that you
sent a patch at all can also be taken as an agreement.


Thanks,
pq

> 
> > S-o-b is mentioned in
> > https://gitlab.freedesktop.org/wayland/wayland/blob/master/CONTRIBUTING.md#sending-patches .
> > 
> > 
> > Thanks,
> > pq
> >
On Fri, Feb 08, 2019 at 12:51:23PM +0200, Pekka Paalanen wrote:
> Weird indeed. Did you manually edit the patch, or copy & paste it?
> 

Copied & pasted it, next time I'll include them in MIME

> > I don't know how to do that, besides I have no intention to license code
> > I submit, so you are completely free to use it.
> 
> The way you do that is you put
> 
> Signed-off-by: Your Real Name <email@address>
> 
> at the end of each commit message. You can check almost any existing
> Wayland commit for an example.
> 

Ok.

> If you do not license your code under the very license the project is
> using, then we cannot take your contributions at all. No license means
> no-one can do anything with it, particularly redistribute it. I once saw
> someone say: the copyright law makes no difference between your patch
> and the latest Disney movie.
> 
> No license: no rights.
> 
> "Feel free to use it" is not a license. We really do need a valid
> license for all contributions. The way that happens is that people
> check the project license (in this case it is duplicated in the top of
> almost every source file, and in the COPYING file at the root
> directory) and agree to that. Putting your S-o-b in the commit message
> is an explicit indicator that you agree, but also the fact that you
> sent a patch at all can also be taken as an agreement.
> 
> 
> Thanks,
> pq
> 

Ok, got it.