unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Erroneous uses of regex in the invokation of FIND-FILES
@ 2019-08-22 10:04 Alex Vong
  2019-08-22 20:49 ` Mark H Weaver
  2019-09-20 20:31 ` Maxim Cournoyer
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Vong @ 2019-08-22 10:04 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

Hello guix,

I find out that there are a lof of erroneous uses of regex in the
invokation of FIND-FILES. The correct usage should be:

  (find-files "." "\\.c$")

Instead people write:

  (find-files "." ".*\\.c")

which match unwanted files.

For examples, in the procedure CUSTOM-GCC, the correct regex should be:

  "(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)$"

instead of:

  ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"

Please correct me if I am wrong.

Right now, the erroneous use of regex in CUSTOM-GCC casues the 'bin/'
directory of the output of gccgo, gcc-objc and gcc-objc++ to be empty.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

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

* Erroneous uses of regex in the invokation of FIND-FILES
@ 2019-08-22 10:14 Alex Vong
  2019-09-20 19:52 ` Maxim Cournoyer
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Vong @ 2019-08-22 10:14 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 716 bytes --]

[Resending...]

Hello guix,

I find out that there are a lof of erroneous uses of regex in the
invokation of FIND-FILES. The correct usage should be:

  (find-files "." "\\.c$")

Instead people write:

  (find-files "." ".*\\.c")

which match unwanted files.

For examples, in the procedure CUSTOM-GCC, the correct regex should be:

  "(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)$"

instead of:

  ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"

Please correct me if I am wrong.

Right now, the erroneous use of regex in CUSTOM-GCC casues the 'bin/'
directory of the output of gccgo, gcc-objc and gcc-objc++ to be empty.

-- 
Stand with Hong Kong!
#Eye4HK
Alex

https://twitter.com/freedomhkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

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

* Re: Erroneous uses of regex in the invokation of FIND-FILES
  2019-08-22 10:04 Alex Vong
@ 2019-08-22 20:49 ` Mark H Weaver
  2019-09-20 20:31 ` Maxim Cournoyer
  1 sibling, 0 replies; 5+ messages in thread
From: Mark H Weaver @ 2019-08-22 20:49 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel

Hi Alex,

Alex Vong <alexvong1995@gmail.com> writes:

> I find out that there are a lof of erroneous uses of regex in the
> invokation of FIND-FILES. The correct usage should be:
>
>   (find-files "." "\\.c$")
>
> Instead people write:
>
>   (find-files "." ".*\\.c")
>
> which match unwanted files.
>
> For examples, in the procedure CUSTOM-GCC, the correct regex should be:
>
>   "(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)$"
>
> instead of:
>
>   ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"
>
> Please correct me if I am wrong.

You're right.  It would be good to fix these problems incrementally, as
long as the changes don't cause too many rebuilds.

Changes to core packages will need to wait for now, since 'core-updates'
is frozen, and 'core-updates-next' should also be considered frozen,
since it will become 'core-updates' as soon as Berlin has built it out a
bit more.  (The only change in 'core-updates-next' relative to
'core-updates' is that the new bootstrap tarballs have been fixed to be
deterministic.)

For some of these fixes, it might be best to apply them to 'staging'.

> Right now, the erroneous use of regex in CUSTOM-GCC casues the 'bin/'
> directory of the output of gccgo, gcc-objc and gcc-objc++ to be empty.

I'm uncertain how many rebuilds it would trigger to change 'custom-gcc',
and I don't have confidence that "guix refresh -l" is capable of giving
us a reliable answer.  In the meantime, would you like to file a bug
report for this, so it's not forgotten?

Thanks for looking into it.

     Best,
      Mark

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

* Re: Erroneous uses of regex in the invokation of FIND-FILES
  2019-08-22 10:14 Erroneous uses of regex in the invokation of FIND-FILES Alex Vong
@ 2019-09-20 19:52 ` Maxim Cournoyer
  0 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2019-09-20 19:52 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel

Hello Alex,

Alex Vong <alexvong1995@gmail.com> writes:

> [Resending...]
>
> Hello guix,
>
> I find out that there are a lof of erroneous uses of regex in the
> invokation of FIND-FILES. The correct usage should be:
>
>   (find-files "." "\\.c$")
>
> Instead people write:
>
>   (find-files "." ".*\\.c")
>
> which match unwanted files.
>
> For examples, in the procedure CUSTOM-GCC, the correct regex should be:
>
>   "(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)$"
>
> instead of:
>
>   ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"
>
> Please correct me if I am wrong.
>
> Right now, the erroneous use of regex in CUSTOM-GCC casues the 'bin/'
> directory of the output of gccgo, gcc-objc and gcc-objc++ to be empty.

I've done the following experiment to validate your findings:

Modified gcc.scm as follows:

--8<---------------cut here---------------start------------->8---
1 file changed, 4 insertions(+), 4 deletions(-)
gnu/packages/gcc.scm | 8 ++++----

modified   gnu/packages/gcc.scm
@@ -631,10 +631,10 @@ as the 'native-search-paths' field."
         `(modify-phases ,phases
            (add-after 'install 'remove-broken-or-conflicting-files
              (lambda* (#:key outputs #:allow-other-keys)
-               (for-each delete-file
-                         (find-files (string-append (assoc-ref outputs "out") "/bin")
-                                     ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))
-               #t))))))))
+               ;; (for-each delete-file
+               ;;           (find-files (string-append (assoc-ref outputs "out") "/bin")
+               ;;                       ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))
+               #f))))))))
 
 (define %generic-search-paths
   ;; This is the language-neutral search path for GCC.  Entries in $CPATH are

--8<---------------cut here---------------end--------------->8---

Then built it with

--8<---------------cut here---------------start------------->8---
./pre-inst-env guix build -K gcc-objc
--8<---------------cut here---------------start------------->8---

The copied the resulting store item under a writable location; e.g.:

--8<---------------cut here---------------start------------->8---
cp -r /gnu/store/7pmfv7bs9krrjdmfnky2q0i1kdhcvmzj-gcc-objc-8.3.0 /tmp/gccgcc-objc-8.3.0
--8<---------------cut here---------------end--------------->8---

And initialize a git repo in that dir:

--8<---------------cut here---------------start------------->8---
cd /tmp/gccgcc-objc-8.3.0; git init && git add . && git commit -m init
--8<---------------cut here---------------end--------------->8---

Then fired up Guile, and ran the following:

$ guile
> ,use (guix build utils)
> (define old-regexp ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)")
> (define new-regexp "(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)$")
> (for-each delete-file (find-files "./bin" old-regexp))

This resulted in the following files being deleted:

--8<---------------cut here---------------start------------->8---
 git status
On branch master
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    bin/c++
        deleted:    bin/cpp
        deleted:    bin/g++
        deleted:    bin/gcc
        deleted:    bin/gcc-ar
        deleted:    bin/gcc-nm
        deleted:    bin/gcc-ranlib
        deleted:    bin/gcov
        deleted:    bin/gcov-dump
        deleted:    bin/gcov-tool
        deleted:    bin/x86_64-unknown-linux-gnu-c++
        deleted:    bin/x86_64-unknown-linux-gnu-g++
        deleted:    bin/x86_64-unknown-linux-gnu-gcc
        deleted:    bin/x86_64-unknown-linux-gnu-gcc-8.3.0
        deleted:    bin/x86_64-unknown-linux-gnu-gcc-ar
        deleted:    bin/x86_64-unknown-linux-gnu-gcc-nm
        deleted:    bin/x86_64-unknown-linux-gnu-gcc-ranlib

no changes added to commit (use "git add" and/or "git commit -a")
--8<---------------cut here---------------end--------------->8---

And the bin directory is empty, as you found:

--8<---------------cut here---------------start------------->8---
ls -al bin/
total 0
drwxr-xr-x 1 mcournoyer users  0 Sep 21 04:31 ./
drwxr-xr-x 1 mcournoyer users 52 Sep 21 04:27 ../
--8<---------------cut here---------------end--------------->8---

Resetting the git repo (git reset --hard), and using the new regexp
instead:

--8<---------------cut here---------------start------------->8---
(for-each delete-file (find-files "./bin" new-regexp))
--8<---------------cut here---------------end--------------->8---

We now obtain:

--8<---------------cut here---------------start------------->8---
git status
On branch master
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    bin/c++
        deleted:    bin/cpp
        deleted:    bin/g++
        deleted:    bin/gcc
        deleted:    bin/gcc-ar
        deleted:    bin/gcc-nm
        deleted:    bin/gcc-ranlib
        deleted:    bin/gcov
        deleted:    bin/x86_64-unknown-linux-gnu-c++
        deleted:    bin/x86_64-unknown-linux-gnu-g++
        deleted:    bin/x86_64-unknown-linux-gnu-gcc
        deleted:    bin/x86_64-unknown-linux-gnu-gcc-8.3.0
        deleted:    bin/x86_64-unknown-linux-gnu-gcc-ar
        deleted:    bin/x86_64-unknown-linux-gnu-gcc-nm
        deleted:    bin/x86_64-unknown-linux-gnu-gcc-ranlib

no changes added to commit (use "git add" and/or "git commit -a")
--8<---------------cut here---------------end--------------->8---

Which is mostly the same except that gcov-dump and gcov-tool are
preserved:

--8<---------------cut here---------------start------------->8---
ls -al ./bin
total 2292
drwxr-xr-x 1 mcournoyer users      36 Sep 21 04:49 ./
drwxr-xr-x 1 mcournoyer users      52 Sep 21 04:27 ../
-rwxr-xr-x 1 mcournoyer users 1155104 Sep 21 04:46 gcov-dump
-rwxr-xr-x 1 mcournoyer users 1185632 Sep 21 04:46 gcov-tool
--8<---------------cut here---------------end--------------->8---

That doesn't seem right either.

Maxim

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

* Re: Erroneous uses of regex in the invokation of FIND-FILES
  2019-08-22 10:04 Alex Vong
  2019-08-22 20:49 ` Mark H Weaver
@ 2019-09-20 20:31 ` Maxim Cournoyer
  1 sibling, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2019-09-20 20:31 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel

Hi again,

Alex Vong <alexvong1995@gmail.com> writes:

> Hello guix,
>
> I find out that there are a lof of erroneous uses of regex in the
> invokation of FIND-FILES. The correct usage should be:
>
>   (find-files "." "\\.c$")
>
> Instead people write:
>
>   (find-files "." ".*\\.c")
>
> which match unwanted files.
>
> For examples, in the procedure CUSTOM-GCC, the correct regex should be:
>
>   "(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)$"
>
> instead of:
>
>   ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"
>
> Please correct me if I am wrong.
>
> Right now, the erroneous use of regex in CUSTOM-GCC casues the 'bin/'
> directory of the output of gccgo, gcc-objc and gcc-objc++ to be empty.

Looking at this some more, I'm not sure what we expect to see in the
bin/ directory of gcc-objc, As I found out earlier, the files present
before any deletion are those:

--8<---------------cut here---------------start------------->8---
c++
cpp
g++
gcc
gcc-ar
gcc-nm
gcc-ranlib
gcov
gcov-dump
gcov-tool
x86_64-unknown-linux-gnu-c++
x86_64-unknown-linux-gnu-g++
x86_64-unknown-linux-gnu-gcc
x86_64-unknown-linux-gnu-gcc-8.3.0
x86_64-unknown-linux-gnu-gcc-ar
x86_64-unknown-linux-gnu-gcc-nm
x86_64-unknown-linux-gnu-gcc-ranlib
--8<---------------cut here---------------end--------------->8---

All of those files don't appear to be specific to gcc-objc (they are
also part of regular gcc) and thus it appear that removing them fits the
bill (the patch name says it exists to remove broken or conflicting
files).

The way that these GCC packages affect the GCC installation is by mean
of extending the search path of the GCC libraries, e.g.:

--8<---------------cut here---------------start------------->8---
(define-public gcc-objc-5
  (custom-gcc gcc-5 "gcc-objc" '("objc")
              (list (search-path-specification
                     (variable "OBJC_INCLUDE_PATH")
                     (files '("include")))
                    (search-path-specification
                     (variable "LIBRARY_PATH")
                     (files '("lib" "lib64"))))))
--8<---------------cut here---------------end--------------->8---

not by providing custom binaries.

Here's the list of files of the regular gcc package:

--8<---------------cut here---------------end--------------->8---
ls -l /gnu/store/ginrh3x6qi4w2i005gics37wzz5b78s7-gcc-5.5.0/bin
total 9308
c++
cpp
g++
gcc
gcc-ar
gcc-nm
gcc-ranlib
gcov
gcov-dump
gcov-tool
x86_64-unknown-linux-gnu-c++
x86_64-unknown-linux-gnu-g++
x86_64-unknown-linux-gnu-gcc
x86_64-unknown-linux-gnu-gcc-5.5.0
x86_64-unknown-linux-gnu-gcc-ar
x86_64-unknown-linux-gnu-gcc-nm
x86_64-unknown-linux-gnu-gcc-ranlib
--8<---------------cut here---------------end--------------->8---

It's confusing though that an empty bin directory is left behind.  We
could fix this.

Maxim

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

end of thread, other threads:[~2019-09-20 20:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-22 10:14 Erroneous uses of regex in the invokation of FIND-FILES Alex Vong
2019-09-20 19:52 ` Maxim Cournoyer
  -- strict thread matches above, loose matches on Subject: below --
2019-08-22 10:04 Alex Vong
2019-08-22 20:49 ` Mark H Weaver
2019-09-20 20:31 ` Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).