Alexpux / MSYS2-pacman

MSYS2 port of Arch Linux packman package manager.
GNU General Public License v2.0
164 stars 34 forks source link

build_references.sh: Check for Windows-style MSYS2 root path. #19

Closed DavidEGrayson closed 8 years ago

DavidEGrayson commented 8 years ago

This helps address issue #16 by printing a warning if $(cygpath -m /) or $(cygpath -m \) is found in the package. The warning looks like this:

image

I generated that warning by trying to build the following test PKGBUILD:

_realname=testpkg
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.0
pkgrel=1
pkgdesc='Test package'
arch=('any')
url='http://www.example.com/'
license=('custom')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-gcc"
)
depends=()
options=()
source=()

sha256sums=()

prepare() {
  mkdir -p "${srcdir}/${_realname}-${pkgver}"
}

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"

  {
    echo "#!/usr/bin/bash"
    echo "cd \"$(cygpath -m /)\""
    echo "pwd"
    echo "cd \"$(cygpath -w /)\""
    echo "pwd"
  } > testpkg
}

check() {
  cd "${srcdir}/build-${MINGW_CHOST}"
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"

  install -Dm644 testpkg "${pkgdir}${MINGW_PREFIX}/bin/testpkg"
}
mingwandroid commented 8 years ago

Thanks!

DavidEGrayson commented 8 years ago

Thank you for merging it, @mingwandroid!

DavidEGrayson commented 8 years ago

Note: I used the -I option to grep in this pull request, so it never finds paths that were embedded in binary files. I can't really remember why I did that, but maybe it's because the other checks in the same file were using -I, and I was concerned about DLLs and executables that have debug info in them. Maybe that was a mistake, because it allows bugs like this one to slip through: https://github.com/Alexpux/MINGW-packages/issues/1309

DavidEGrayson commented 4 years ago

Four years have passed and we still have broken packages causing problems for some people:

https://stackoverflow.com/q/58380995/28128