[PATCH] detect case insensitive file system

7 views
Skip to first unread message

Qian Yun

unread,
Feb 24, 2021, 5:17:25 AM2/24/21
to fricas...@googlegroups.com
Hi all,

This patch detects case insensitive file system and prevents
in-tree build on such systems, which would result in strange
build error later.

First time using autotools, comments are welcome.

BTW, do you think it's useful for FriCAS to build in-tree
correctly on a case insensitive file system?

- Qian


https://github.com/oldk1331/fricas/commit/3f01da7a2f41ffb38e25e79e6292c33ee12e4bfa

From 3f01da7a2f41ffb38e25e79e6292c33ee12e4bfa Mon Sep 17 00:00:00 2001
From: Qian Yun <oldk...@gmail.com>
Date: Wed, 24 Feb 2021 18:01:52 +0800
Subject: [PATCH] detect in tree build error on case insensitive file system

---
configure | 14 ++++++++++++++
configure.ac | 11 +++++++++++
2 files changed, 25 insertions(+)

diff --git a/configure b/configure
index 5b64cbc16..2524d8f5a 100755
--- a/configure
+++ b/configure
@@ -2468,6 +2468,20 @@ $as_echo "$as_me: WARNING: Cross build is not
supported." >&2;}
$as_echo "$as_me: WARNING: Please notify fricas...@googlegroups.com
if you succeed." >&2;}
fi

+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a case sensitive
file system" >&5
+$as_echo_n "checking for a case sensitive file system... " >&6; }
+if test -e /bIn/Sh; then
+ if test "$fricas_top_srcdir" = "$fricas_pwd"; then
+ as_fn_error $? "in tree build on case insensitive file system is
not supported. Use out-of-source build instead." "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+
## Accumulate list of utils needed for the build platform
fricas_all_prerequisites=

diff --git a/configure.ac b/configure.ac
index 6c9e24f91..a386b3578 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,17 @@ if test $build != $target; then
AC_MSG_WARN([Please notify fricas...@googlegroups.com if you
succeed.])
fi

+AC_MSG_CHECKING([for a case sensitive file system])
+if test -e /bIn/Sh; then
+ if test "$fricas_top_srcdir" = "$fricas_pwd"; then
+ AC_MSG_ERROR([in tree build on case insensitive file system is
not supported. Use out-of-source build instead.])
+ else
+ AC_MSG_RESULT([no])
+ fi
+else
+ AC_MSG_RESULT([yes])
+fi
+
## Accumulate list of utils needed for the build platform
fricas_all_prerequisites=

Waldek Hebisch

unread,
Feb 24, 2021, 2:49:34 PM2/24/21
to fricas...@googlegroups.com
On Wed, Feb 24, 2021 at 06:17:17PM +0800, Qian Yun wrote:
> Hi all,
>
> This patch detects case insensitive file system and prevents
> in-tree build on such systems, which would result in strange
> build error later.
>
> First time using autotools, comments are welcome.

AFAICS you make resonable effort to detect if filesystem
containing /bin/sh is case-sensitive. In many cases
this is the same filesysytem as build tree, but in many
cases this is distinct filesystem. IMO we should check
directly build tree. Just create file there and check
if it can be accessed using different case.

> BTW, do you think it's useful for FriCAS to build in-tree
> correctly on a case insensitive file system?

Useful: yes to some degree. However ATM gain seem to be
to small compared to the effort. I hope that problem
will go away when we improve our build system (in particular
I would like to avoid splitting .spad files into pieces
which is responsible for current problem).

--
Waldek Hebisch

Qian Yun

unread,
Feb 25, 2021, 5:37:04 AM2/25/21
to fricas...@googlegroups.com


On 2/25/21 3:49 AM, Waldek Hebisch wrote:
> On Wed, Feb 24, 2021 at 06:17:17PM +0800, Qian Yun wrote:
>> Hi all,
>>
>> This patch detects case insensitive file system and prevents
>> in-tree build on such systems, which would result in strange
>> build error later.
>>
>> First time using autotools, comments are welcome.
>
> AFAICS you make resonable effort to detect if filesystem
> containing /bin/sh is case-sensitive. In many cases
> this is the same filesysytem as build tree, but in many
> cases this is distinct filesystem. IMO we should check
> directly build tree. Just create file there and check
> if it can be accessed using different case.

Thanks for your feedback. This check was borrowed from automake.
The following updated check is borrowed from CVS, is it OK to commit
this version?

- Qian

+AC_MSG_CHECKING([for in-tree build on case insensitive file system])
+if test "$fricas_top_srcdir" = "$fricas_pwd"; then
+ rm -f ac_TEST_filenames_CASE_sensitive ac_test_filenames_case_sensitive
+ echo foo > ac_test_filenames_case_sensitive
+ if test -f ac_TEST_filenames_CASE_sensitive; then
+ rm ac_test_filenames_case_sensitive
+ AC_MSG_ERROR([in tree build on case insensitive file system is
not supported. Use out-of-source build instead.])
+ else
+ rm ac_test_filenames_case_sensitive
+ AC_MSG_RESULT([no])
+ fi
+else
+ AC_MSG_RESULT([no])
+fi

https://github.com/oldk1331/fricas/commit/3c8f8b50c314e6d8c949580b8cb10b79a3cc2d99.patch

Waldek Hebisch

unread,
Feb 25, 2021, 6:49:34 PM2/25/21
to fricas...@googlegroups.com
On Thu, Feb 25, 2021 at 06:36:52PM +0800, Qian Yun wrote:
>
>
> On 2/25/21 3:49 AM, Waldek Hebisch wrote:
> > On Wed, Feb 24, 2021 at 06:17:17PM +0800, Qian Yun wrote:
> > > Hi all,
> > >
> > > This patch detects case insensitive file system and prevents
> > > in-tree build on such systems, which would result in strange
> > > build error later.
> > >
> > > First time using autotools, comments are welcome.
> >
> > AFAICS you make resonable effort to detect if filesystem
> > containing /bin/sh is case-sensitive. In many cases
> > this is the same filesysytem as build tree, but in many
> > cases this is distinct filesystem. IMO we should check
> > directly build tree. Just create file there and check
> > if it can be accessed using different case.
>
> Thanks for your feedback. This check was borrowed from automake.
> The following updated check is borrowed from CVS, is it OK to commit
> this version?

Yes, please commit.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages