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

fix: fix incorrect path substitution in sed command #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

defitricks
Copy link

Description

There was a missing / after $input_dir in the sed command, which could result in incorrect path substitution. If the path started with $input_dir but contained subdirectories, the replacement might not work as expected.

Now, the command explicitly matches the beginning of the string using ^ and ensures $input_dir/ is properly removed.

How Has This Been Tested?

Tested by running the modified command with various input paths, including cases with and without subdirectories. The results now correctly remove $input_dir/ only when it appears at the beginning of the path.

Checklist:

Before deployment

  • 100% test and branch coverage
  • check slither for severe issues
  • fuzz and invariant tests (when applicable)
  • formal verification (when applicable)
  • deployment or upgrade scripts ready

After deployment

  • transfer ownership after deployments (when applicable)
  • complete upgrade (when applicable)
  • generate deployment/upgrade log files

Considerations

  • I have followed the contributing guidelines.
  • My code follows the style guidelines of this project and I have run forge fmt and prettier to ensure the code style is valid
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Additional context

Verification

For example, given:

input_dir="src/pkgs/example"
sol_file="src/pkgs/example/contracts/MyContract.sol"

The original sed command would produce:

contracts/MyContract.sol

However, without / after input_dir, it could produce incorrect results if the path structure is more complex.

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.

1 participant