Skip to content

Define PATH_MAX and MAXPATHLEN for GNU/Hurd compatibility#5046

Merged
ctrlcctrlv merged 2 commits intofontforge:masterfrom
anthonyfok:PATH_MAX-and-MAXPATHLEN-for-GNU-Hurd
Jun 17, 2022
Merged

Define PATH_MAX and MAXPATHLEN for GNU/Hurd compatibility#5046
ctrlcctrlv merged 2 commits intofontforge:masterfrom
anthonyfok:PATH_MAX-and-MAXPATHLEN-for-GNU-Hurd

Conversation

@anthonyfok
Copy link
Copy Markdown
Contributor

@anthonyfok anthonyfok commented Jun 16, 2022

On GNU Hurd systems (such as Debian GNU/Hurd), Fontforge failed to build from source (FTBFS) because of MAXPATHLEN and PATH_MAX being undefined on Hurd, e.g.

/usr/bin/cc  -I../../inc -Iinc -isystem /usr/include/glib-2.0 -isystem /usr/lib/i386-gnu/glib-2.0/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Werror=implicit-function-declaration -Werror=int-conversion -fdiagnostics-color=always -std=gnu99 -MD -MT gutils/CMakeFiles/gutils.dir/fsys.c.o -MF gutils/CMakeFiles/gutils.dir/fsys.c.o.d -o gutils/CMakeFiles/gutils.dir/fsys.c.o -c ../../gutils/fsys.c
../../gutils/fsys.c:51:22: error: ‘MAXPATHLEN’ undeclared here (not in a function); did you mean ‘MAXNAMLEN’?
   51 | static char dirname_[MAXPATHLEN+1];
      |                      ^~~~~~~~~~
      |                      MAXNAMLEN

Special thanks to fellow Debian Developers @henrich, @ucko and @kilobyte for reporting the issue and offering suggestions on a fix back in 2017; see #3119 and https://bugs.debian.org/877795.

Hurd's philosophy of using dynamic memory allocation for these variables aside (thanks to @jtanx for the reference), defining PATH_MAX and MAXPATHLEN as 4096 for GNU Hurd (distinguished by its unique __GNU__ definition) is an easy and non-intrusive solution that would make Fontforge truly universal, as can be seen in the Fontforge build for all 23 architectures that Debian builds for at https://buildd.debian.org/status/package.php?p=fontforge.

This patch has been tested to build successfully on Hurd (and all architectures) with the Debian release of fontforge (1:20201107~dfsg-4) on 2021-01-15.

Fixes #3119

Type of change

  • Bug fix
  • Non-breaking change

Special thanks to @henrich, @ucko and @kilobyte for reporting the issue
and offering suggestions on a fix.

See also https://bugs.debian.org/877795

Fixes fontforge#3119
@anthonyfok anthonyfok force-pushed the PATH_MAX-and-MAXPATHLEN-for-GNU-Hurd branch from 0868190 to 1a6aa06 Compare June 16, 2022 08:40
Copy link
Copy Markdown
Member

@ctrlcctrlv ctrlcctrlv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no problem; although obviously Hurd users won't be getting much benefit from the relaxed limit if all software does this.

I added a comment in cf80140 because I'd be confused by the intended meaning of __GNU__, and assume others would be as it's an uncommon macro.

@ctrlcctrlv ctrlcctrlv merged commit 78ca228 into fontforge:master Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build failure for GNU/Hurd

2 participants