Skip to content

[Tools - Toolchains] Allow dependency parsing to fail, gracefully continuing #3229

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

Merged
merged 1 commit into from
Nov 15, 2016

Conversation

theotherjimmy
Copy link
Contributor

@theotherjimmy theotherjimmy commented Nov 8, 2016

Description

If, say, you compile with gcc_arm and kill it at just the right time you will have an empty dependency file. This empty dependency file will cause a python traceback in dependency parsing, preventing you from compiling until you next clean.

This PR lets that weird corner case compile.

Status

READY

Reviews

should resolve #3226

Reproducing the issue

We can simulate the very precise timing needed to reproduce this bug by simply emptying a .d file

  1. Run any mbed compile command using gcc_arm in a working project (any target will do).
  2. Find any .d file for the project (for example I'll use BUILD/k64f/gcc_arm/main.d)
  3. Run this command, replacing my example file with a file chosen in step 2
echo -n > BUILD/k64f/gcc_arm/main.d
  1. Run the mbed compile again to see the failure.
...
Scan: mbed
Scan: env
[ERROR] list index out of range
[mbed] ERROR: "python" returned error code 1.

Copy link
Contributor

@screamerbg screamerbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 9, 2016

What I am missing how was this patch tested (partially that info is in the issue, but we should encourage users and we should do the same, add tests info to the pull requests). Commands used, targets , toolchains, anything relevant.

@bridadan
Copy link
Contributor

bridadan commented Nov 9, 2016

/morph test

@theotherjimmy
Copy link
Contributor Author

@0xc0170 is the Reproducing the issue section what you were looking for (I added it since you commented)

@mbed-bot
Copy link

mbed-bot commented Nov 9, 2016

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1034

All builds and test passed!

deps = self.parse_dependencies(dep_path) if (exists(dep_path)) else []
try:
deps = self.parse_dependencies(dep_path) if (exists(dep_path)) else []
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bare "except:" is generally considered poor practice. E.g. a well-timed Ctrl-C, instead of stopping compilation, may instead cause more compilation to take place.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 11, 2016

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1071

All builds and test passed!

@sg-
Copy link
Contributor

sg- commented Nov 15, 2016

@mazimkhan @marhil01 Can API rate limit error be handled more gracefully or fixed?

@sg- sg- merged commit ef7c618 into ARMmbed:master Nov 15, 2016
@mazimkhan
Copy link

Sure I will schedule some time to fix it. Thanks for the patience.

@theotherjimmy theotherjimmy deleted the allow-deps-to-fail branch November 15, 2016 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"mbed compile" fails with "list index out of range"
8 participants