https://sourceware.org/bugzilla/show_bug.cgi?id=32003
--- Comment #13 from Benjamin Drung <bdrung at posteo dot de> --- (In reply to H.J. Lu from comment #12) > (In reply to Benjamin Drung from comment #11) > > (In reply to H.J. Lu from comment #9) > > > It should be human readable. > > > > What do you recommend? IMO percent-escaping is readable enough and increases > > the size of the already long string not too much. > > > > The encoding of the JSON > > {"type":"deb","os":"ubuntu","name":"dpkg","version":"1.22.6ubuntu15", > > "architecture":"amd64"} would be: > > > > -Wl,--encoded-package-metadata=%7B%22type%22:%22deb%22%2C%22os%22: > > %22ubuntu%22%2C%22name%22:%22dpkg%22%2C%22version%22:%221.22. > > 6ubuntu15%22%2C%22architecture%22:%22amd64%22%7D > > > > At first it might look confusing, but the relevant strings can be seen on a > > second look: "type", "deb", "os", "ubuntu", "name", "dpkg", "version", > > "1.22.6ubuntu15", "architecture", "amd64". Only the beginning of the version > > number is harder to see. > > > > There are multiple tools that can encode/decode it. For example Python's > > urllib.parse.unquote and urllib.parse.quote. > > > > I am open for better encodings. I am open for making --package-metadata > > percent-decode the value instead of adding a new parameter. Percents are > > relative safe encoding option. The Debian package name and the Debian > > version are not allowed to contain percents. The os, type, and architecture > > will not have percents in the > > %22 isn't human readable. Do we need to escape { and }? Maybe escaping { and } is not needed. > We need to escape " and ,. Those two are definitively needed to be escaped. > Should $ be supported in JSON code? $ needs to be escaped for shells. Theoretically $ might be part of a string. > Will "%[string]" escape work? Like this? -Wl,--encoded-package-metadata={%[quot]type%[quot]:%[quot]deb%[quot]%[comma]%[quot]os%[quot]:%[quot]ubuntu%[quot]%[comma]%[quot]name%[quot]:%[quot]dpkg%[quot]%[comma]%[quot]version%[quot]:%[quot]1.22.6ubuntu15%[quot]%[comma]%[quot]architecture%[quot]:%[quot]amd64%[quot]} This might work, but it is much longer. IMO on a scale from human readable to random character this is insignificantly more readable. A longer parameter makes it harder to find the relevant log output (in case of problems unrelated to the package metadata) and the log files will be bigger. Debian package tend to print all calls with all compiler parameters. -- You are receiving this mail because: You are on the CC list for the bug.