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

pkg -e generates incorrect expanded manifest #1933

Closed
danfe opened this issue Jan 19, 2021 · 9 comments · Fixed by vstakhov/libucl#253
Closed

pkg -e generates incorrect expanded manifest #1933

danfe opened this issue Jan 19, 2021 · 9 comments · Fixed by vstakhov/libucl#253
Assignees

Comments

@danfe
Copy link
Contributor

danfe commented Jan 19, 2021

When packages are created with expanded manifest (-e option), the resulting manifest file is broken, because it is not correct JSON.

@bapt
Copy link
Member

bapt commented Jan 19, 2021

the manifest is not supposed to be json at all

@bapt bapt closed this as completed Jan 19, 2021
@danfe
Copy link
Contributor Author

danfe commented Jan 19, 2021

Then pkg(8) should handle it better. Try generating package with a license which includes the plus sign, e.g. archivers/gzip, and install it. I'll getting this:

# pkg add <wrkdir>/pkg/gzip-1.10.txz 
pkg: Error parsing manifest: error while parsing <unknown>: line: 41, column: 45 - 'invalid character in a key', character: '+'
pkg: /tmp/usr/ports/archivers/gzip/work/pkg/gzip-1.10.txz is not a valid package: Invalid manifest
# pkg -v
1.16.1

@bapt
Copy link
Member

bapt commented Jan 19, 2021

pkg should handle what better ? I don't understand what you are trying to do, the +MANIFEST is a ucl file, as long as the ucl file is valid the manifest will be parsed correctly

@danfe
Copy link
Contributor Author

danfe commented Jan 19, 2021

So if you make package in archivers/gzip with -e added to the PKG_CREATE_ARGS and then can add it via pkg add without issues?

@bapt
Copy link
Member

bapt commented Jan 19, 2021

yes I can do that as long as I use a UCL valid syntax

@danfe
Copy link
Contributor Author

danfe commented Jan 19, 2021

Hm, that's strange. What is the checksum of generated +MANIFEST for archivers/gzip port on your machine with -e?

as long as I use a UCL valid syntax

No, no, we don't deal with UCL directly at all, it's about calling make PKG_CREATE_ARGS='-e -r ${STAGEDIR}' package and result it produces.

@bapt
Copy link
Member

bapt commented Jan 19, 2021

ok I misunderstood the bug, now I got it and I can reproduce

@bapt bapt reopened this Jan 19, 2021
@bapt
Copy link
Member

bapt commented Jan 19, 2021

@vstakhov sounds like a bug in libucl which I can easily reproduce:
echo '"a+" = b' | ./utils/ucl_tool | ./utils/ucl_tool

The first call is generating a UCL output which cannot then be parsed again by the second one

@vstakhov
Copy link
Member

Indeed,

LuaJIT 2.1.0-beta3> p:parse_string('"a+" = b')
true
LuaJIT 2.1.0-beta3> p:get_object()
{[a+] = b}
LuaJIT 2.1.0-beta3> u.to_format(p:get_object(), 'ucl')
a+ = "b";

LuaJIT 2.1.0-beta3> p:parse_string(u.to_format(p:get_object(), 'ucl'))
false
error while parsing <unknown>: line: 1, column: 0 - 'delimiter is missing', character: 'a'

UCL should escape '+' character in this case (and the whole key in fact). JSON works fine in this case.

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

Successfully merging a pull request may close this issue.

3 participants