After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796011 - Crash in ScanDirectory caused by overlooked use of renamed `dir` variable
Crash in ScanDirectory caused by overlooked use of renamed `dir` variable
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
unspecified
Other Linux
: Normal critical
: 1.29
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2018-05-10 18:44 UTC by Adam Williamson
Modified: 2018-05-10 19:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix for the bug (1.25 KB, patch)
2018-05-10 18:44 UTC, Adam Williamson
committed Details | Review

Description Adam Williamson 2018-05-10 18:44:38 UTC
Created attachment 371906 [details] [review]
fix for the bug

9292e0a renamed the first argument to `ScanDirectory` from `dir` to `scan_dir`, but one use of `dir` was not renamed. When this line gets hit, it causes gtk-doc to crash:

html/ActUser.html:524: warning: no link for: "G-SIGNAL-RUN-LAST:CAPS" -> (Run Last).
cp: cannot stat './libaccountsservice.pdf': No such file or directory
make[4]: [Makefile:817: dist-hook] Error 1 (ignored)
Traceback (most recent call last):
  • File "/usr/bin/gtkdoc-rebase", line 56 in <module>
    sys.exit(rebase.run(options))
  • File "/usr/share/gtk-doc/python/gtkdoc/rebase.py", line 75 in run
    ScanDirectory(dir, options)
  • File "/usr/share/gtk-doc/python/gtkdoc/rebase.py", line 133 in ScanDirectory
    ScanDirectory(subdir, options)
  • File "/usr/share/gtk-doc/python/gtkdoc/rebase.py", line 114 in ScanDirectory
    onlinedir = ReadIndex(dir, entry)
  • File "/usr/share/gtk-doc/python/gtkdoc/rebase.py", line 153 in ReadIndex
    for line in common.open_text(os.path.join(dir, file)):
  • File "/usr/lib64/python3.6/posixpath.py", line 80 in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not builtin_function_or_method
make[4]: *** [Makefile:821: dist-hook] Error 1

The fix is simple, just correct the variable name to `scan_dir`. Patch attached.
Comment 1 Adam Williamson 2018-05-10 18:45:22 UTC
Note hitting this line got much easier in 1.28 because of https://git.gnome.org/browse/gtk-doc/commit/?id=b77d97bfe0186eb727604dbad565dc4dde0eb273 . Before that fix, at least accountsservice never actually hit this line, because the ReadDevhelp regex did not match so there was no `onlinedir`.
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2018-05-10 19:43:42 UTC
Thanks a lot. gtkdoc-rebase really needs some python tests :/ Contributions here would be very welcome.
Comment 3 Adam Williamson 2018-05-10 19:49:03 UTC
I'm unfortunately a bit too overloaded to commit to anything like that ATM, sorry :/ just happened to be chatting with halfline when he ran into these and was able to see what was wrong.

(FWIW, I like pytest for writing tests, it's an awesome framework. Its handling of test fixtures and parametrization is great.)