corrode icon indicating copy to clipboard operation
corrode copied to clipboard

corrode-cc crashes on some inputs

Open eternaleye opened this issue 8 years ago • 2 comments

lmdb/libraries/liblmdb $ PATH="${CORRODE_BUILD}:${CORRODE_SCRIPTS}:${PATH}" make CC=corrode-cc
corrode-cc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized   -c mdb.c
corrode-cc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized   -c midl.c
Traceback (most recent call last):
  File "/home/Alex.Elsayed/Code/rust/corrode/scripts/corrode-cc", line 48, in <module>
    outfile = str(PurePath(rsfile).with_suffix(".o"))
  File "/usr/x86_64-pc-linux-gnu/lib/python3.5/pathlib.py", line 622, in __new__
    return cls._from_parts(args)
  File "/usr/x86_64-pc-linux-gnu/lib/python3.5/pathlib.py", line 651, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/usr/x86_64-pc-linux-gnu/lib/python3.5/pathlib.py", line 643, in _parse_args
    % type(a))
TypeError: argument should be a path or str object, not <class 'bytes'>
make: *** [Makefile:86: midl.o] Error 1

lmdb is https://github.com/lmdb/lmdb

eternaleye avatar Oct 30 '16 01:10 eternaleye

This change fixed the issue for me:

diff --git a/scripts/corrode-cc b/scripts/corrode-cc
index b7e37c02925a..17a3cb55f853 100755
--- a/scripts/corrode-cc
+++ b/scripts/corrode-cc
@@ -45,7 +45,7 @@ if '-c' in cflags:
         ).stdout.splitlines()[0]

         if outfile is None:
-            outfile = str(PurePath(rsfile).with_suffix(".o"))
+            outfile = str(PurePath(rsfile.decode()).with_suffix(".o"))

         rustwarn = subprocess.run(
             ['rustc', '--crate-type=dylib', '--emit', 'obj', '-o', outfile, rsfile],

eternaleye avatar Oct 30 '16 01:10 eternaleye

Same issue here. The patch works just fine, thank you @eternaleye

frafra avatar Oct 21 '18 20:10 frafra