pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Compile issue with glibc-2.27 (copy_file_range)
3+ messages / 3 participants
[nested] [flat]

* Compile issue with glibc-2.27 (copy_file_range)
@ 2018-02-04 13:21  Thomas Trepl <thomas@linuxfromscratch.org>
  0 siblings, 2 replies; 3+ messages in thread

From: Thomas Trepl @ 2018-02-04 13:21 UTC (permalink / raw)
  To: pgsql-bugs

Hi,

according to changlelog of glibc-2.27 they introduced a new function
named "copy_file_range".

There is a static function in src/bin/pg_rewind/copy_fetch.c with the
same name and therefore compilation fails with 

>>>>>>>>
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-
statement -Wendif-labels -Wmissing-format-attribute -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2
-I../../../src/interfaces/libpq -DFRONTEND -I../../../src/include  -
D_GNU_SOURCE   -c -o copy_fetch.o copy_fetch.c
copy_fetch.c:159:1: Fehler: In Konflikt stehende Typen für
»copy_file_range«
 copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
 ^~~~~~~~~~~~~~~
In file included from copy_fetch.c:15:0:
/usr/include/unistd.h:1110:9: Anmerkung: Vorherige Deklaration von
»copy_file_range« war hier
 ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
         ^~~~~~~~~~~~~~~
make[3]: *** [<eingebaut>: copy_fetch.o] Fehler 1
make[3]: Verzeichnis „/tmp/postgresql/build/postgresql-
10.1/src/bin/pg_rewind“ wird verlassen
make[2]: *** [Makefile:40: all-pg_rewind-recurse] Fehler 2
make[2]: Verzeichnis „/tmp/postgresql/build/postgresql-10.1/src/bin“
wird verlassen
make[1]: *** [Makefile:37: all-bin-recurse] Fehler 2
make[1]: Verzeichnis „/tmp/postgresql/build/postgresql-10.1/src“ wird
verlassen
make: *** [GNUmakefile:11: all-src-recurse] Fehler 2
<<<<<<<<

Since postgresql's copy_file_range is static/local to only one file,
its easy to fix:

sed -e "s/copy_file_range/pg_&/" \
    -i  src/bin/pg_rewind/copy_fetch.c

which renames "copy_file_range" to "pg_copy_file_range". Find attached
a patch doing the same.

System: Linux (LFS 20180202)
glibc:  2.27
gcc:    7.3
Kernel: 4.15.1
PgSql:  10.1

--
Thomas

Attachments:

postgresql-10.1-fix_glibc_clash-1.patch (text/x-patch, 1.4K) download diff -Naur postgresql-10.1.orig/src/bin/pg_rewind/copy_fetch.c postgresql-10.1/src/bin/pg_rewind/copy_fetch.c --- postgresql-10.1.orig/src/bin/pg_rewind/copy_fetch.c 2017-11-07 01:46:52.000000000 +0100 +++ postgresql-10.1/src/bin/pg_rewind/copy_fetch.c 2018-02-04 13:55:22.417162961 +0100 @@ -156,7 +156,7 @@ * If 'trunc' is true, any existing file with the same name is truncated. */ static void -copy_file_range(const char *path, off_t begin, off_t end, bool trunc) +pg_copy_file_range(const char *path, off_t begin, off_t end, bool trunc) { char buf[BLCKSZ]; char srcpath[MAXPGPATH]; @@ -222,7 +222,7 @@ break; case FILE_ACTION_COPY: - copy_file_range(entry->path, 0, entry->newsize, true); + pg_copy_file_range(entry->path, 0, entry->newsize, true); break; case FILE_ACTION_TRUNCATE: @@ -230,7 +230,7 @@ break; case FILE_ACTION_COPY_TAIL: - copy_file_range(entry->path, entry->oldsize, entry->newsize, false); + pg_copy_file_range(entry->path, entry->oldsize, entry->newsize, false); break; case FILE_ACTION_CREATE: @@ -257,7 +257,7 @@ while (datapagemap_next(iter, &blkno)) { offset = blkno * BLCKSZ; - copy_file_range(path, offset, offset + BLCKSZ, false); + pg_copy_file_range(path, offset, offset + BLCKSZ, false); /* Ok, this block has now been copied from new data dir to old */ } pg_free(iter);
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: Compile issue with glibc-2.27 (copy_file_range)
@ 2018-02-04 14:03  Dmitry Dolgov <9erthalion6@gmail.com>
  parent: Thomas Trepl <thomas@linuxfromscratch.org>
  1 sibling, 0 replies; 3+ messages in thread

From: Dmitry Dolgov @ 2018-02-04 14:03 UTC (permalink / raw)
  To: Thomas Trepl <thomas@linuxfromscratch.org>; +Cc: pgsql-bugs

> On 4 February 2018 at 14:21, Thomas Trepl <thomas@linuxfromscratch.org> wrote:
> according to changlelog of glibc-2.27 they introduced a new function
> named "copy_file_range".
>
> There is a static function in src/bin/pg_rewind/copy_fetch.c with the
> same name and therefore compilation fails with

It was already renamed some time ago, see commit [1]

[1]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=3e68686e2c55799234ecd020bd1621f91...




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Compile issue with glibc-2.27 (copy_file_range)
@ 2018-02-04 14:06  Michael Paquier <michael.paquier@gmail.com>
  parent: Thomas Trepl <thomas@linuxfromscratch.org>
  1 sibling, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2018-02-04 14:06 UTC (permalink / raw)
  To: Thomas Trepl <thomas@linuxfromscratch.org>; +Cc: pgsql-bugs

On Sun, Feb 04, 2018 at 02:21:38PM +0100, Thomas Trepl wrote:
> according to changlelog of glibc-2.27 they introduced a new function
> named "copy_file_range".

Yes, some buildfarm machines caught that already.  Here is the commit
fixing it, which will be available in next week's round of minor
releases:

commit: 3e68686e2c55799234ecd020bd1621f913d65475
author: Andres Freund <andres@anarazel.de>
date: Wed, 3 Jan 2018 12:40:32 -0800
Rename pg_rewind's copy_file_range() to avoid conflict with new linux syscall.

Upcoming versions of glibc will contain copy_file_range(2), a wrapper
around a new linux syscall for in-kernel copying of data ranges. This
conflicts with pg_rewinds function of the same name.

Therefore rename pg_rewinds version. As our version isn't a generic
copying facility we decided to choose a rewind specific function name.

Per buildfarm animal caiman and subsequent discussion with Tom Lane.

Author: Andres Freund
Discussion:
    https://postgr.es/m/20180103033425.w7jkljth3e26sduc@alap3.anarazel.de
    https://postgr.es/m/31122.1514951044@sss.pgh.pa.us
Backpatch: 9.5-, where pg_rewind was introduced

This report reminds me that I haven't patched yet the version of
pg_rewind for REL9_4_STABLE and REL9_3_STABLE that I maintain for
VMware.  Will do that now..
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-02-04 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-04 13:21 Compile issue with glibc-2.27 (copy_file_range) Thomas Trepl <thomas@linuxfromscratch.org>
2018-02-04 14:03 ` Dmitry Dolgov <9erthalion6@gmail.com>
2018-02-04 14:06 ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox