# pkg_libchk



## talsamon (Nov 7, 2014)

I don't know if it's a bug or my enviroment. `Pkg_libchk` shows on the begin of the output more than a dozen (After begin not more of this) 
	
	



```
grep: Unmatched [ or [^
```
 Only on Bash-4.3.30(0). (Works without problems on csh). .
On FreeBSD-10.0 the problem is solved with recompile the port (sysutils/bsdadminscripts). On FreeBSD-9.3 I had to
Change in line 211 of /usr/local/sbin/pkg_libchk

: 
	
	



```
grep -E "^[[:space:]]*OS/ABI:[[:space:]]*UNIX - $osname\
$" \
```
  the double-quotes in single-quotes.

(But curious: in FreeBSD-10.0 works this line with double-quotes).

I only want to know, if someone other has the same problem, or it's only mine.


----------



## talsamon (Nov 7, 2014)

I found "half" the reason: the command `pkg_libchk` (with double-quotes on 9.3) brings the error, `/usr/local/sbin/pkg_libchk` not.
But /usr/local/sbin is in $PATH.


----------



## talsamon (Nov 7, 2014)

Something wrong is with that. Update to bsdadminscripts-6.1.1_8. Now the error is on both Freebsd-9.3 and 10.0.
Works with `sudo. pkg_libchk` - has ever worked without `sudo`. Error the same as above. With double-quotes works with root, with single-quotes as user. ......


----------



## wblock@ (Nov 8, 2014)

I don't know about others, but I can't tell what you mean by "with double-quotes".  Show exact examples of what you type and the error message.  It might be a problem with a bash built-in.  But pkg_libchk specifies /bin/sh as an interpreter.  For a problem to happen would mean /bin/sh has been linked to bash a Linuxism that will break on FreeBSD.


----------



## talsamon (Nov 8, 2014)

wblock@ said:


> I can't tell what you mean by "with double-quotes"


Is exactly described above.
It's not really important. Cause it works. But I want to know, have I do something wrong, or is it perhaps only a sideeffect.


----------



## wblock@ (Nov 8, 2014)

Your description is not clear, mixes together "with double quotes", "with single quotes", different versions of FreeBSD, sudo, and who knows what else.  Instead of throwing it all in a bucket and describing it with ambiguous words, just show it:

On FreeBSD 10.1, I did this:

```
% pkg_libchk ""
vague error
% "pkg_libchk"
unknown error
% 'pkg_libchk'
mysterious error
% sudo . pkg_libchk
what?
```


----------



## talsamon (Nov 8, 2014)

this is the error


talsamon said:


> grep: Unmatched [ or [^


this is the original line (211) in /usr/local/sbin/pkg_libchk


talsamon said:


> grep -E "^[[:space:]]*OS/ABI:[[:space:]]*UNIX - $osname\ $" \


with double-quotes the error appears
This only in bash and if I used it with normal user (group wheel)
If I use it with `sudo` the error doesn't appear.
(I changed this) with single-quotes it doesn't appear.



```
ls -al /usr/local/sbin/pkg_libchk
-r-xr-xr-x  1 root  wheel  11961  8 Nov 00:46 /usr/local/sbin/pkg_libchk
```


----------



## talsamon (Nov 8, 2014)

I found it, it's a bug, an escape error
the line

```
grep -E "^[[:space:]]*OS/ABI:[[:space:]]*UNIX - $osname\$" \
```

should be ($ with two backslashes)

```
grep -E "^[[:space:]]*OS/ABI:[[:space:]]*UNIX - $osname\\$" \
```


----------

