Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with multiline value of pkgdesc variable #30

Open
Zebradil opened this issue Apr 1, 2017 · 6 comments
Open

Issue with multiline value of pkgdesc variable #30

Zebradil opened this issue Apr 1, 2017 · 6 comments

Comments

@Zebradil
Copy link

Zebradil commented Apr 1, 2017

I'm creating this issue just to give info to googlers. It is fixed in #29

/usr/bin/customizepkg: line 167: warning: command substitution: ignored null byte in input
/usr/bin/customizepkg: eval: line 167: unexpected EOF while looking for matching `"'
/usr/bin/customizepkg: eval: line 168: syntax error: unexpected end of file
@Zebradil Zebradil reopened this May 3, 2017
@AdrienLemaire
Copy link

AdrienLemaire commented May 30, 2019

@ava1ar I just installed customizepkg, and when running yay -Syu, I get the following errors:

[Aur: 2]  slack-desktop-3.4.2-1  qt4-4.8.7-30

  2 slack-desktop                    (Installed) (Build Files Exist)
  1 qt4                              (Installed) (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 
:: PKGBUILD up to date, Skipping (1/2): qt4
:: PKGBUILD up to date, Skipping (2/2): slack-desktop
:: Parsing SRCINFO (1/2): slack-desktop
:: Parsing SRCINFO (2/2): qt4
/usr/bin/customizepkg: line 167: warning: command substitution: ignored null byte in input
no configuration found for slack-desktop in /home/dori/.customizepkg/ or /etc/customizepkg.d/
/usr/bin/customizepkg: line 167: warning: command substitution: ignored null byte in input
no configuration found for qt4 in /home/dori/.customizepkg/ or /etc/customizepkg.d/
/usr/bin/customizepkg: line 167: warning: command substitution: ignored null byte in input
no configuration found for slack-desktop in /home/dori/.customizepkg/ or /etc/customizepkg.d/
Can not find package name : [customizepkg.d]

Is it related to this issue? Can you merge the related PR?

$ yay -Qs customizepkg
local/customizepkg-git 57.f1d7be7-1
    A tool to modify automatically PKGBUILD

@ava1ar
Copy link
Owner

ava1ar commented May 30, 2019

PR was merged. Please confirm it solves the issue. Thanks!

@AdrienLemaire
Copy link

@ava1ar Thanks!

I have a more serious issue with yay now ^^ after removing customizepkg-git, all downloads are failing, I can't reinstall customizepkg-git through yay

$ yay -S customizepkg-git --nomakepkgconf 
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur: 1]  customizepkg-git-51.6cf63cb-1

  1 customizepkg-git                 (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> A
:: Deleting (1/1): /home/dori/.cache/yay/customizepkg-git
:: Downloaded PKGBUILD (1/1): customizepkg-git
:: Parsing SRCINFO (1/1): customizepkg-git
Error downloading sources: customizepkg-git

I can install this the manual way with pacman, but I'd like to understand why this problem occured in the first place. Do you have an idea?

@whoizit
Copy link

whoizit commented Feb 11, 2022

/usr/bin/customizepkg: line 168: warning: command substitution: ignored null byte in input
no configuration found for cwtch in /home/user/.customizepkg/ or /etc/customizepkg.d/

this is the same issue?
affected for pkgs fluffychat, cwtch, libcwtch-go and others I forget.

@JustCryen
Copy link
Contributor

JustCryen commented Jan 6, 2025

Today I have noticed this error when updating aur/discover-overlay

/usr/bin/customizepkg: eval: line 168: unexpected EOF while looking for matching `}'

This seems to be the same issue

@JustCryen
Copy link
Contributor

line mentioned in the customizepkg is:

eval $(grep -Pazo '(^|[^[:print:]])[[:blank:]]*_?(pkg.*|name)=(\((.|\n)*?\)|[^#]*?(?= *#|\x0a))' ./PKGBUILD | grep -Eva '\$\(|`|pkgdesc' | tr -d '\0')

Well, maybe it's not an issue with the pkgdesc this time.
The program is has a bizzare PKGBUILD structure:

pkgname=discover-overlay
_name=${pkgname#python-}
_pep625_name=${_name//-/_}
pkgver=0.7.8
pkgrel=1
pkgdesc='Yet another Discord overlay for Linux written in Python using GTK3'
arch=('x86_64')
url='https://github.com/trigg/Discover'
license=('GPL3')

claui added a commit to claui/customizepkg that referenced this issue Feb 10, 2025
Bash has a feature called parameter substitutions.
PKGBUILDs sometimes use that feature to strip
prefixes:

```
pkgname="python-foo"
_name=${pkgname#python-}
```

Because the syntax includes a hash sign (#), the
current version of customizepkg’s regex pattern
misinterprets usage of this feature as a
line comment:

```plain

[^#]*?(?= *#|\x0a)
^^^^^^               capture the part before the `#` sign
         ^^^         cut off the rest of the line
```

The problem with this pattern is that it
interprets the `#` sign as the beginning of a
line comment, even if it’s not preceded by a
whitespace, including usages of parameter
substitution. That means the pattern cuts off in
the middle of a param-subst expression, causing
customizepkg to abort with an error message:

> /usr/bin/customizepkg: eval: line 168: unexpected EOF while looking for matching `}'

Examples of affected packages:

- discover-overlay [1]
- python-llm [2]
- python-progress [3]

This problem has also been mentioned in a comment
on GitHub issue ava1ar#30 [1] (however I think that the
comment is unrelated to the multiline problem.)

Fix the issue by requiring at least one whitespace
in order to detect the start of a line comment:

```plain

.*?(?=( +#)|\x0a)
^^                   capture as much as we need
      ^^^^^          cut off only if ` #` appears
                     (hash sign preceded by space)
```

[1]: ava1ar#30 (comment)
[2]: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-llm
[3]: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-progress
claui added a commit to claui/customizepkg that referenced this issue Feb 10, 2025
Bash has a feature called parameter expansion. [1]
PKGBUILDs sometimes use that feature to strip
prefixes:

```
pkgname="python-foo"
_name=${pkgname#python-}
```

Because the syntax includes a hash sign (#), the
current version of customizepkg’s regex pattern
misinterprets usage of this feature as a
line comment:

```plain

[^#]*?(?= *#|\x0a)
^^^^^^               capture the part before the `#` sign
         ^^^         cut off the rest of the line
```

The problem with this pattern is that it
interprets the `#` sign as the beginning of a
line comment, even if it’s not preceded by a
whitespace, including usages of parameter
expansion. That means the pattern cuts off in
the middle of a parameter expansion, causing
customizepkg to abort with an error message:

> /usr/bin/customizepkg: eval: line 168: unexpected EOF while looking for matching `}'

Examples of affected packages:

- discover-overlay [2]
- python-llm [3]
- python-progress [4]

This problem has also been mentioned in a comment
on GitHub issue ava1ar#30 [2] (however I think that the
comment is unrelated to the multiline problem.)

Fix the issue by requiring at least one whitespace
in order to detect the start of a line comment:

```plain

.*?(?=( +#)|\x0a)
^^                   capture as much as we need
      ^^^^^          cut off only if ` #` appears
                     (hash sign preceded by space)
```

[1]: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
[2]: ava1ar#30 (comment)
[3]: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-llm
[4]: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-progress
ava1ar pushed a commit that referenced this issue Feb 22, 2025
Bash has a feature called parameter expansion. [1]
PKGBUILDs sometimes use that feature to strip
prefixes:

```
pkgname="python-foo"
_name=${pkgname#python-}
```

Because the syntax includes a hash sign (#), the
current version of customizepkg’s regex pattern
misinterprets usage of this feature as a
line comment:

```plain

[^#]*?(?= *#|\x0a)
^^^^^^               capture the part before the `#` sign
         ^^^         cut off the rest of the line
```

The problem with this pattern is that it
interprets the `#` sign as the beginning of a
line comment, even if it’s not preceded by a
whitespace, including usages of parameter
expansion. That means the pattern cuts off in
the middle of a parameter expansion, causing
customizepkg to abort with an error message:

> /usr/bin/customizepkg: eval: line 168: unexpected EOF while looking for matching `}'

Examples of affected packages:

- discover-overlay [2]
- python-llm [3]
- python-progress [4]

This problem has also been mentioned in a comment
on GitHub issue #30 [2] (however I think that the
comment is unrelated to the multiline problem.)

Fix the issue by requiring at least one whitespace
in order to detect the start of a line comment:

```plain

.*?(?=( +#)|\x0a)
^^                   capture as much as we need
      ^^^^^          cut off only if ` #` appears
                     (hash sign preceded by space)
```

[1]: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
[2]: #30 (comment)
[3]: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-llm
[4]: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants