From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#29686: gnu: aspell: Do not ignore GuixOS system profile. Date: Wed, 13 Nov 2019 18:51:43 +0100 Message-ID: <87v9rnmzps.fsf@gnu.org> References: <87vahbgmbc.fsf@gmail.com> <871sjygus3.fsf@gnu.org> <87a7ydy21j.fsf@gnu.org> <873745wj6i.fsf@gmail.com> <87h8slunjn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:59971) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUwoK-0000kw-6b for bug-guix@gnu.org; Wed, 13 Nov 2019 12:52:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iUwoI-0004H6-Sd for bug-guix@gnu.org; Wed, 13 Nov 2019 12:52:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51304) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iUwoI-0004Gw-Pb for bug-guix@gnu.org; Wed, 13 Nov 2019 12:52:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iUwoF-0002G7-Pa for bug-guix@gnu.org; Wed, 13 Nov 2019 12:52:06 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87h8slunjn.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 20 Dec 2017 21:55:40 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Oleg Pykhalov Cc: 29686@debbugs.gnu.org, Pierre Neidhardt --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Oleg & Pierre, ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Indeed. I have: > > $ guix environment --ad-hoc aspell aspell-dict-ru -C -- aspell --config |= grep -A3 dict-dir > # dict-dir (string) > # location of the main word list > # default: <$ASPELL_DICT_DIR|home-dir/.guix-profile/lib/aspell> =3D /gnu/= store/b411b0fbwc85fjnf0h030gdkbv1qdmqh-profile/lib/aspell > dict-dir /home/ludo/.guix-profile/lib/aspell > > # encoding (string) > # encoding to expect data to be in > -- > # default: =3D /home/ludo/.guix-profile/lib/aspell/ > > # master (string) > # base name of the main dictionary to use > > The value that shows up after the =E2=80=9C=3D=E2=80=9D sign is as expect= ed (it=E2=80=99s > $ASPELL_DICT_DIR), but the value shown on the line below is not. > > Sounds like a problem in =E2=80=98aspell-dict-dir.patch=E2=80=99. Actually the problem is the =E2=80=98wrap-aspell=E2=80=99 phase, which pred= ates =E2=80=98aspell-dict-dir.patch=E2=80=99 and is unnecessary in the presence = of this patch. In addition to removing the phase, the patch had to be adjusted so that it would actually adjust the right-hand size of =E2=80=98|=E2=80=99 for =E2= =80=98dict-dir=E2=80=99 (a bug that apparently went unnoticed, probably because the =E2=80=98wrap-aspe= ll=E2=80=99 phase was hiding it). With the patch below, I get: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix environment --ad-hoc aspell aspell-dict-ru -C -- aspe= ll --config |grep -A2 '^# dict-dir' # dict-dir (string) # location of the main word list # default: <$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell> =3D /gnu/store= /adfc4l73nw3ccai3h5im21wblmrhfy4z-profile/lib/aspell --8<---------------cut here---------------end--------------->8--- and: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix environment --ad-hoc aspell aspell-dict-ru -C -- aspe= ll dicts ru ru-ye ru-yeyo ru-yo --8<---------------cut here---------------end--------------->8--- =E2=80=A6 while still getting the intended result when running it outside = =E2=80=98guix environment=E2=80=99: --8<---------------cut here---------------start------------->8--- $ (unset ASPELL_DICT_DIR; ./pre-inst-env guix environment --ad-hoc aspell = -K -- aspell --config) |grep -A2 '^# dict-dir' # dict-dir (string) # location of the main word list # default: <$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell> =3D /home/ludo= /.guix-profile/lib/aspell $ (unset ASPELL_DICT_DIR; ./pre-inst-env guix environment --ad-hoc aspell = -K -- aspell dicts) |wc -l 58 $ (unset HOME; ./pre-inst-env guix environment --ad-hoc aspell -K -- aspel= l dicts) |wc -l 58 --8<---------------cut here---------------end--------------->8--- I=E2=80=99ll apply it on =E2=80=98core-updates=E2=80=99 if it=E2=80=99s fin= e with you. Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/gnu/packages/aspell.scm b/gnu/packages/aspell.scm index af38c149c2..a5d02a453d 100644 --- a/gnu/packages/aspell.scm +++ b/gnu/packages/aspell.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2013, 2014, 2015, 2017, 2018 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2013, 2014, 2015, 2017, 2018, 2019 Ludovic Court=C3= =A8s ;;; Copyright =C2=A9 2015, 2016 Alex Kost ;;; Copyright =C2=A9 2016 John Darrington ;;; Copyright =C2=A9 2016, 2017, 2019 Efraim Flashner @@ -65,14 +65,6 @@ (("\"filter-path(.*)DICT_DIR" _ middle) (string-append "\"filter-path" middle "\"" libdir "\""))) - #t))) - (add-after 'install 'wrap-aspell - (lambda* (#:key outputs #:allow-other-keys) - (let ((bin/aspell (string-append (assoc-ref outputs "out") - "/bin/aspell"))) - (wrap-program bin/aspell - '("ASPELL_CONF" "" =3D - ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix= -profile}/lib/aspell\"}"))) #t)))))) (inputs `(("perl" ,perl))) =20 diff --git a/gnu/packages/patches/aspell-default-dict-dir.patch b/gnu/packa= ges/patches/aspell-default-dict-dir.patch index 17a6ff606f..5f759a66d9 100644 --- a/gnu/packages/patches/aspell-default-dict-dir.patch +++ b/gnu/packages/patches/aspell-default-dict-dir.patch @@ -8,12 +8,34 @@ However it is necessary for applications that use libaspe= ll since =20 --- a/common/config.cpp +++ b/common/config.cpp +@@ -651,7 +651,20 @@ namespace acommon { + } else { // sep =3D=3D '|' + assert(replace[0] =3D=3D '$'); + const char * env =3D getenv(replace.c_str()+1); +- final_str +=3D env ? env : second; ++ if (env) { ++ final_str +=3D env; ++ } else if (second[0] =3D=3D '$') { ++ // Expand the right-hand side of '|', which starts with a ++ // reference to an environment variable. ++ auto slash =3D second.find('/'); ++ String variable =3D second.substr(1, slash - 1); ++ const char * env =3D getenv(variable.c_str()); ++ String value =3D env ? String(env) : ""; ++ value +=3D second.substr(slash, second.size() - slash); ++ final_str +=3D value; ++ } else { ++ final_str +=3D second; ++ } + } + replace =3D ""; + in_replace =3D false; @@ -1349,6 +1349,9 @@ namespace acommon { # define REPL ".aspell..prepl" #endif =20=20 +#undef DICT_DIR -+#define DICT_DIR "<$ASPELL_DICT_DIR|home-dir/.guix-profile/lib/aspell>" ++#define DICT_DIR "<$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell>" + static const KeyInfo config_keys[] =3D { // the description should be under 50 chars --=-=-=--