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

Airframe comments parsing corner case #14150

Closed
MaEtUgR opened this issue Feb 13, 2020 · 1 comment
Closed

Airframe comments parsing corner case #14150

MaEtUgR opened this issue Feb 13, 2020 · 1 comment
Assignees
Labels
bug Tools Sub-tools used within PX4 ecosystem (scripts, etc)

Comments

@MaEtUgR
Copy link
Member

MaEtUgR commented Feb 13, 2020

Describe the bug
If you do not specify an @maintainer tag in your airframe configuration but put a comment afterwards then the parsing fails with an unexpected error.

@cmic0 found the bug originally.

To Reproduce
Steps to reproduce the behavior:

  1. Replace the maintainer line of an airframe configuration e.g. https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/airframes/4001_quad_x#L20 with # Some comment
  2. Do make clean
  3. Build e.g. make px4_fmu-v5
  4. See error

Expected behavior
The parser should either still work without maintainer tag or ask for a maintainer but not fail unexpectedly in the parsing state machine.

Log Files and Screenshots

[0/1294] git submodule platforms/nuttx/NuttX/nuttx
[1/1294] Creating airframes.xml
FAILED: airframes.xml 
cd /home/maetugr/Firmware/build/px4_fmu-v5_default && /usr/bin/python3 /home/maetugr/Firmware/Tools/px_process_airframes.py --airframes-path /home/maetugr/Firmware/ROMFS/px4fmu_common/init.d --board CONFIG_ARCH_BOARD_px4_fmu-v5 --xml /home/maetugr/Firmware/build/px4_fmu-v5_default/airframes.xml
Traceback (most recent call last):
  File "/home/maetugr/Firmware/Tools/px_process_airframes.py", line 138, in <module>
    main()
  File "/home/maetugr/Firmware/Tools/px_process_airframes.py", line 102, in main
    if not scanner.ScanDir(args.airframes_path, parser):
  File "/home/maetugr/Firmware/Tools/px4airframes/srcscanner.py", line 22, in ScanDir
    if not self.ScanFile(path, parser):
  File "/home/maetugr/Firmware/Tools/px4airframes/srcscanner.py", line 38, in ScanFile
    return parser.Parse(path, contents)
  File "/home/maetugr/Firmware/Tools/px4airframes/srcparser.py", line 366, in Parse
    tags[current_tag] += "\n" + comment_content
KeyError: 'output'
[7/1294] ROMFS: copying, generating airframes
FAILED: genromfs/init.d/rcS genromfs/init.d/rc.serial genromfs/init.d/rc.autostart genromfs/init.d/rc.autostart.post ROMFS/romfs_copy.stamp 
cd /home/maetugr/Firmware/build/px4_fmu-v5_default/ROMFS && /usr/bin/cmake -E remove_directory /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs && /usr/bin/cmake -E copy_directory /home/maetugr/Firmware/ROMFS/px4fmu_common /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs && /usr/bin/cmake -E remove_directory /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs/init.d-posix && /usr/bin/cmake -E remove_directory /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs/mixers-sitl && /usr/bin/cmake -E remove /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs/mixers/CMakeLists.txt && /usr/bin/cmake -E remove /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs/init.d/CMakeLists.txt && /usr/bin/cmake -E remove /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs/init.d/airframes/CMakeLists.txt && /usr/bin/python3 /home/maetugr/Firmware/Tools/px_process_airframes.py --airframes-path /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs/init.d --start-script /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs/init.d/rc.autostart --board px4_fmu-v5 && /usr/bin/python3 /home/maetugr/Firmware/Tools/serial/generate_config.py --rc-dir /home/maetugr/Firmware/build/px4_fmu-v5_default/genromfs/init.d --serial-ports GPS1:/dev/ttyS0 TEL1:/dev/ttyS1 TEL2:/dev/ttyS2 TEL4:/dev/ttyS3 --config-files /home/maetugr/Firmware/src/lib/battery/module.yaml /home/maetugr/Firmware/src/drivers/distance_sensor/cm8jl65/module.yaml /home/maetugr/Firmware/src/drivers/distance_sensor/leddar_one/module.yaml /home/maetugr/Firmware/src/drivers/distance_sensor/sf0x/module.yaml /home/maetugr/Firmware/src/drivers/distance_sensor/tfmini/module.yaml /home/maetugr/Firmware/src/drivers/distance_sensor/ulanding_radar/module.yaml /home/maetugr/Firmware/src/drivers/dshot/module.yaml /home/maetugr/Firmware/src/drivers/gps/module.yaml /home/maetugr/Firmware/src/drivers/rc_input/module.yaml /home/maetugr/Firmware/src/drivers/roboclaw/module.yaml /home/maetugr/Firmware/src/drivers/telemetry/frsky_telemetry/module.yaml /home/maetugr/Firmware/src/drivers/telemetry/hott/hott_telemetry/module.yaml /home/maetugr/Firmware/src/drivers/telemetry/iridiumsbd/module.yaml /home/maetugr/Firmware/src/modules/battery_status/module.yaml /home/maetugr/Firmware/src/modules/mavlink/module.yaml && /usr/bin/cmake -E touch romfs_copy.stamp
Traceback (most recent call last):
  File "/home/maetugr/Firmware/Tools/px_process_airframes.py", line 138, in <module>
    main()
  File "/home/maetugr/Firmware/Tools/px_process_airframes.py", line 102, in main
    if not scanner.ScanDir(args.airframes_path, parser):
  File "/home/maetugr/Firmware/Tools/px4airframes/srcscanner.py", line 22, in ScanDir
    if not self.ScanFile(path, parser):
  File "/home/maetugr/Firmware/Tools/px4airframes/srcscanner.py", line 38, in ScanFile
    return parser.Parse(path, contents)
  File "/home/maetugr/Firmware/Tools/px4airframes/srcparser.py", line 366, in Parse
    tags[current_tag] += "\n" + comment_content
KeyError: 'output'
[11/1294] Generating uORB topic headers
ninja: build stopped: subcommand failed.
make: *** [Makefile:202: px4_fmu-v5] Error 1

I had a quick look but didn't see the problem immediately... probably needs debugging if important enough.

@MaEtUgR MaEtUgR added bug Tools Sub-tools used within PX4 ecosystem (scripts, etc) labels Feb 13, 2020
@MaEtUgR MaEtUgR self-assigned this Feb 13, 2020
@JacobCrabill
Copy link
Member

I think I encountered this error a while back too - I don't think general non-tag comments are supported by the parser. My solution was to add a "@desc" tag that is ignored by the parser, allowing you to write a multi-line comment. I can put a PR in for this (pretty small change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Tools Sub-tools used within PX4 ecosystem (scripts, etc)
Projects
None yet
Development

No branches or pull requests

3 participants