Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1833095 - dblatex: TypeError: can't concat str to bytes
Summary: dblatex: TypeError: can't concat str to bytes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dblatex
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michael J Gruber
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-07 19:17 UTC by Damian Wrobel
Modified: 2021-03-19 19:55 UTC (History)
6 users (show)

Fixed In Version: dblatex-0.3.12-2.fc33 dblatex-0.3.12-2.fc32 dblatex-0.3.12-2.fc34
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-03-05 19:16:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Damian Wrobel 2020-05-07 19:17:49 UTC
Description of problem:
dblatex returns with a cryptic message:

    TypeError: can't concat str to bytes

when I added to the /usr/bin/dblatex try/except/print(traceback.format_exc()) I got the following exception:

Unexpected error occured
Error: can't concat str to bytes
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/dbtexmf/core/dbtex.py", line 758, in main
    run.compile()
  File "/usr/lib/python3.8/site-packages/dbtexmf/core/dbtex.py", line 366, in compile
    donefiles = self._compile()
  File "/usr/lib/python3.8/site-packages/dbtexmf/core/dbtex.py", line 436, in _compile
    self.make_tex()
  File "/usr/lib/python3.8/site-packages/dbtexmf/core/dbtex.py", line 338, in make_tex
    self.rawtex.parse(d.rawfile, d.texfile)
  File "/usr/lib/python3.8/site-packages/dbtexmf/dblatex/rawtex.py", line 81, in parse
    line = self.figconvert(line)
  File "/usr/lib/python3.8/site-packages/dbtexmf/dblatex/rawtex.py", line 104, in figconvert
    line = re.sub(br"{"+fig+br"}", br"{"+newfig+br"}", line)
TypeError: can't concat str to bytes

Version-Release number of selected component (if applicable):
$ rpm -qv dblatex inkscape
dblatex-0.3.11-4.fc32.noarch
inkscape-1.0-1.fc33.x86_64

I'm not sure wheter is the correct fix but at least this type of change fixes the issue for me:

$ diff -u /usr/lib/python3.8/site-packages/dbtexmf/dblatex/rawtex.py.orig /usr/lib/python3.8/site-packages/dbtexmf/dblatex/rawtex.py
--- /usr/lib/python3.8/site-packages/dbtexmf/dblatex/rawtex.py.orig	2020-01-29 21:48:34.000000000 +0000
+++ /usr/lib/python3.8/site-packages/dbtexmf/dblatex/rawtex.py	2020-05-07 19:09:40.275932036 +0000
@@ -101,6 +101,10 @@
 
             # If something done, replace the figure in the tex file
             if newfig != fig:
+                if isinstance(fig, str):
+                    fig = fig.encode("utf-8")
+                if isinstance(newfig, str):
+                    newfig = newfig.encode("utf-8")
                 line = re.sub(br"{"+fig+br"}", br"{"+newfig+br"}", line)
 
         return line


BTW it would be also nice to have by default try/except/print(traceback.format_exc()) in all of the python wrappers located in /usr/bin. I'm not sure is setuptools could do that magically?

Comment 1 Damian Wrobel 2020-05-07 19:19:23 UTC
- I'm not sure is setuptools could do that magically?
+ I'm not sure if setuptools could do that magically?

Comment 2 Michael J Gruber 2020-06-30 19:45:06 UTC
No comment from upstream on this one yet, so I guess I'll go with a local patch. Is it OK to credit you with your bz name and address when I try to upstream the patch?

Comment 3 Damian Wrobel 2020-06-30 20:01:03 UTC
(In reply to Michael J Gruber from comment #2)
> Is it OK to credit you with your bz name and address when I try to upstream the patch?
Yes, that's fine.

Comment 4 Ben Cotton 2020-08-11 13:26:28 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 5 Michael J Gruber 2021-02-18 11:44:47 UTC
Sorry for the late reply.

There was no direct response upstream to this report, but a new release which was not announced on the devel list and which renamed the package (so no monitoring triggers).

The new release does not include your fix, but other fixes there might prevent "mixed string types" from being passed to the function that your patch touches. Can you test with dblatex 0.3.12 from here:

Rawhide: https://koji.fedoraproject.org/koji/taskinfo?taskID=62216410
F34: https://koji.fedoraproject.org/koji/taskinfo?taskID=62217189
F33: https://koji.fedoraproject.org/koji/taskinfo?taskID=62217264

Rawhide should show up in the repo soon, the others are scratch builds only so far.

Comment 6 Damian Wrobel 2021-02-24 21:37:55 UTC
I tested it on the same package which didn't work previously and now it works (see: bug 1833047, comment 8 for more information).

Comment 7 Michael J Gruber 2021-02-25 09:37:54 UTC
(In reply to Damian Wrobel from comment #6)
> I tested it on the same package which didn't work previously and now it
> works (see: bug 1833047, comment 8 for more information).

Perfect, thanks a lot!

Package builds upcoming ...

Comment 8 Fedora Update System 2021-02-25 10:04:01 UTC
FEDORA-2021-22912790bc has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-22912790bc

Comment 9 Fedora Update System 2021-02-25 10:04:49 UTC
FEDORA-2021-5a6ed5d7ea has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-5a6ed5d7ea

Comment 10 Fedora Update System 2021-02-25 10:05:31 UTC
FEDORA-2021-b4faa1684d has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-b4faa1684d

Comment 11 Fedora Update System 2021-02-25 23:45:12 UTC
FEDORA-2021-22912790bc has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-22912790bc`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-22912790bc

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2021-02-26 00:44:50 UTC
FEDORA-2021-5a6ed5d7ea has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-5a6ed5d7ea`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-5a6ed5d7ea

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2021-02-26 01:33:17 UTC
FEDORA-2021-b4faa1684d has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-b4faa1684d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-b4faa1684d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2021-03-05 19:16:09 UTC
FEDORA-2021-5a6ed5d7ea has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 15 Fedora Update System 2021-03-05 19:23:25 UTC
FEDORA-2021-b4faa1684d has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 16 Fedora Update System 2021-03-19 17:37:55 UTC
FEDORA-2021-22912790bc has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 17 Fedora Update System 2021-03-19 19:55:27 UTC
FEDORA-2021-22912790bc has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.