[arch-haskell] [PATCH 3/3] Quote PKGBUILD variables to prevent word expansion.

Xyne xyne at archlinux.ca
Thu Sep 26 02:19:44 CEST 2013


---
 src/Util/Translation.hs | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/Util/Translation.hs b/src/Util/Translation.hs
index 98b62bd..93d035f 100644
--- a/src/Util/Translation.hs
+++ b/src/Util/Translation.hs
@@ -173,15 +173,15 @@ instance Pretty ArchPkg where
             where
                 libBuildFunction = text "build() {" <>
                     nest 4 (empty <$>
-                        text "cd ${srcdir}/${_hkgname}-${pkgver}" <$>
+                        text "cd \"${srcdir}/${_hkgname}-${pkgver}\"" <$>
                         maybe empty (\ _ ->
-                            text $ "patch " ++ shVarValue hkgName ++ ".cabal ${srcdir}/cabal.patch ")
+                            text $ "patch " ++ shVarValue hkgName ++ ".cabal \"${srcdir}/cabal.patch\" ")
                             cabalPatchFile <$>
                         maybe empty (\ _ ->
-                            text $ "patch -p4 < ${srcdir}/source.patch")
+                            text $ "patch -p4 < \"${srcdir}/source.patch\"")
                             buildPatchFile <$>
                         nest 4 (text "runhaskell Setup configure -O -p --enable-split-objs --enable-shared \\" <$>
-                            text "--prefix=/usr --docdir=/usr/share/doc/${pkgname} \\" <$>
+                            text "--prefix=/usr --docdir=\"/usr/share/doc/${pkgname}\" \\" <$>
                             text "--libsubdir=\\$compiler/site-local/\\$pkgid" <> confFlags) <$>
                         text "runhaskell Setup build" <$>
                         text "runhaskell Setup haddock" <$>
@@ -192,14 +192,14 @@ instance Pretty ArchPkg where
                     char '}'
 
                 exeBuildFunction = text "build() {" <>
-                    nest 4 (empty <$> text "cd ${srcdir}/${_hkgname}-${pkgver}" <$>
+                    nest 4 (empty <$> text "cd \"${srcdir}/${_hkgname}-${pkgver}\"" <$>
                         maybe empty
-                            (\ _ -> text $ "patch " ++ shVarValue hkgName ++ ".cabal ${srcdir}/cabal.patch ")
+                            (\ _ -> text $ "patch " ++ shVarValue hkgName ++ ".cabal \"${srcdir}/cabal.patch\" ")
                             cabalPatchFile <$>
                         maybe empty (\ _ ->
-                            text $ "patch -p4 < ${srcdir}/source.patch")
+                            text $ "patch -p4 < \"${srcdir}/source.patch\"")
                             buildPatchFile <$>
-                        text "runhaskell Setup configure -O --prefix=/usr --docdir=/usr/share/doc/${pkgname}" <> confFlags <$>
+                        text "runhaskell Setup configure -O --prefix=/usr --docdir=\"/usr/share/doc/${pkgname}\"" <> confFlags <$>
                         text "runhaskell Setup build"
                         ) <$>
                     char '}'
@@ -211,20 +211,20 @@ instance Pretty ArchPkg where
 
                 libPackageFunction = text "package() {" <>
                     nest 4 (empty <$>
-                        text "cd ${srcdir}/${_hkgname}-${pkgver}" <$>
-                        text "install -D -m744 register.sh   ${pkgdir}/usr/share/haskell/${pkgname}/register.sh" <$>
-                        text "install    -m744 unregister.sh ${pkgdir}/usr/share/haskell/${pkgname}/unregister.sh" <$>
-                        text "install -d -m755 ${pkgdir}/usr/share/doc/ghc/html/libraries" <$>
-                        text "ln -s /usr/share/doc/${pkgname}/html ${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}" <$>
-                        text "runhaskell Setup copy --destdir=${pkgdir}" <$>
-                        (maybe empty (\ _ -> text "install -D -m644 ${_licensefile} ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" <$>
-                            text "rm -f ${pkgdir}/usr/share/doc/${pkgname}/${_licensefile}") licenseFile)
+                        text "cd \"${srcdir}/${_hkgname}-${pkgver}\"" <$>
+                        text "install -D -m744 register.sh   \"${pkgdir}/usr/share/haskell/${pkgname}/register.sh\"" <$>
+                        text "install    -m744 unregister.sh \"${pkgdir}/usr/share/haskell/${pkgname}/unregister.sh\"" <$>
+                        text "install -d -m755 \"${pkgdir}/usr/share/doc/ghc/html/libraries\"" <$>
+                        text "ln -s \"/usr/share/doc/${pkgname}/html\" \"${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}\"" <$>
+                        text "runhaskell Setup copy --destdir=\"${pkgdir}\"" <$>
+                        (maybe empty (\ _ -> text "install -D -m644 \"${_licensefile}\" \"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE\"" <$>
+                            text "rm -f \"${pkgdir}/usr/share/doc/${pkgname}/${_licensefile}\"") licenseFile)
                         ) <$>
                     char '}'
 
                 exePackageFunction = text "package() {" <>
-                    nest 4 (empty <$> text "cd ${srcdir}/${_hkgname}-${pkgver}" <$>
-                        text "runhaskell Setup copy --destdir=${pkgdir}"
+                    nest 4 (empty <$> text "cd \"${srcdir}/${_hkgname}-${pkgver}\"" <$>
+                        text "runhaskell Setup copy --destdir=\"${pkgdir}\""
                         ) <$>
                     char '}'
 
-- 
1.8.4




More information about the arch-haskell mailing list