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

Potential bug for FileServer when running binary on a different Linux host #2593

Closed
commandline-be opened this issue Aug 8, 2023 · 3 comments
Labels
triage A bug report being investigated

Comments

@commandline-be
Copy link

commandline-be commented Aug 8, 2023

Description

After review of code and documentation i cannot but come to think this may be a bug

To Reproduce

#2592

Expected Behavior

not use a static path when running a compiled binary when using FileServer::from(relative!($path))

Environment:

  • OS Distribution and Kernel: Linux
  • Rocket Version: v0.5.0-rc.3

Additional Context

tera template does not seem to take the relative! macro and make the path relative, it leaves a static path in the release binary

@commandline-be commandline-be added the triage A bug report being investigated label Aug 8, 2023
@commandline-be commandline-be changed the title Potential bug for FileServer Potential bug for FileServer when running binary on a different Linux kernel Aug 9, 2023
@commandline-be commandline-be changed the title Potential bug for FileServer when running binary on a different Linux kernel Potential bug for FileServer when running binary on a different Linux host Aug 9, 2023
@commandline-be
Copy link
Author

does work when writing

  .mount("/css", FileServer::from(relative!("css")))
  .mount("/img", FileServer::from(relative!("img")))

as

  .mount("/css", FileServer::from("/full/destination/path/here/css"))  
  .mount("/img", FileServer::from("/full/destination/path/here/img"))  

for now leaving this as a potential bug report

@SergioBenitez
Copy link
Member

Responding to this in the discussion.

@SergioBenitez SergioBenitez closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2023
@giuliohome
Copy link

giuliohome commented Sep 22, 2024

Aside from the fact that the documentation is unclear (which is a separate issue), this also seems to be a potential bug that was closed without a clear justification. There is, in fact, no real use case for the relative! macro, and it is apparent that the installation directory will differ from the build directory. The ability to choose between an absolute or a relative path is already implicit in the string itself. Therefore, in addition to improving the documentation, the necessity of the relative! macro in the code is debatable.
relative! transforms a relative path into an absolute path based on the build directory, which is not where static files are served from in most deployment environments. This is a critical flaw because the build directory is often temporary or irrelevant post-build The decision to close the issue without addressing the concerns about deployment path correctness appears problematic. If the macro enforces or generates paths that lead to incorrect or unusable configurations, its existence in the codebase is not just questionable but likely harmful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage A bug report being investigated
Projects
None yet
Development

No branches or pull requests

3 participants