Skip to content

Correct imprecise regex in moveModuleUp function (fixes #444) #447

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 2 commits into from
Feb 18, 2020
Merged

Correct imprecise regex in moveModuleUp function (fixes #444) #447

merged 2 commits into from
Feb 18, 2020

Conversation

jimpudar
Copy link

@jimpudar jimpudar commented Jan 7, 2020

The existing regex had the side effect of matching python files
from other modules if their filename or path happened to contain
the string s_.

The existing regex had the side effect of matching python files
from other modules if their filename or path happened to contain
the string `s_`.
@jimpudar
Copy link
Author

@dschep any comments on this PR? Based on our conversation in #444 it seems to me this should be good to merge.

@dschep
Copy link
Contributor

dschep commented Jan 14, 2020

@alexdebrie can you confirm this will work fine with sls pro?

@jimpudar
Copy link
Author

@alexdebrie any comments on this?

@dschep
Copy link
Contributor

dschep commented Jan 25, 2020

welp, he doesn't work at serverless any more either.. @astuyve are there any pythonistas left? 😬

@astuyve
Copy link

astuyve commented Jan 25, 2020

I'm always game to learn, could we write a bit more about how to reproduce this bug? I'm happy to give it a shot and let you know

@dschep
Copy link
Contributor

dschep commented Jan 25, 2020

If i'm not mistaken, it's taht it would include a file like foos_ball.py when otherwise the include/exclude rules would have excluded it. Mostly wanting to make sure this change doesn't break sls pro.

@jimpudar
Copy link
Author

@astuyve, here is a minimal example to show the issue.

Directory structure looks like this:

.
├── package-lock.json
├── package.json
├── package1
│   └── handler.py
├── package2_matches_regex
│   └── handler.py
└── serverless.yml

The serverless.yml file:

service: bug444

provider:
  name: aws
  runtime: python3.8

package:
  individually: true

functions:
  hello1:
    module: package1
    handler: handler.hello
  hello2:
    module: package2_matches_regex
    handler: handler.hello

plugins:
  - serverless-python-requirements

After running sls package and examining the zipped files in .serverless, we can see that the package1-bug444-dev-hello1 zip file contains the spurious package2_matches_regex directory.

package1-bug444-dev-hello1
├── handler.py
└── package2_matches_regex
    └── handler.py

package2_matches_regex-bug444-dev-hello2
└── handler.py

Hopefully it's clear why this is undesirable, let me know if you need any further elaboration.

Copy link
Contributor

@bsamuel-ui bsamuel-ui left a comment

Choose a reason for hiding this comment

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

This makes sense based on my reading of the related issue and comments.

@bsamuel-ui bsamuel-ui merged commit 5f4133f into serverless:master Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants