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

infinitely looped path for my jobs app #3426

Open
prod-feng opened this issue Mar 16, 2024 · 2 comments
Open

infinitely looped path for my jobs app #3426

prod-feng opened this issue Mar 16, 2024 · 2 comments
Labels
bug Existing functionality not working as expected
Milestone

Comments

@prod-feng
Copy link

Hello,

I found there's might be a bug that handles the path, when user uses "Job Composer-> From Specified Path". By dafault OnDemand will use $HOME as the DATAROOT for "myjobs" app. So when user use $HOME(like ~/) as the "Source path" for the "From Specified Path), it will cause  infinitely looped path of ~/ondemand/data folder rsynced. OOD only checks the size of the "Source folder", and uses "du" command timeout fo safe copy check, which can not absolutely avoid this situation.

Th finitely looped path rsynced looks like the following:

/home/user1/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/ondemand/data/sys/myjobs/projects/default/2/

I have prepared a solution for this issue, by adding 3 lines of codes in app/models/filesystem.rb, to block the use of $HOME by users and give warning message:

 #
 # Exclude user's $HOME folder, avoid infinitely looped path rsynced, when the the DATAROOT is not set, or set to ~/ondemand/data/sys/myjobs/
 #
 if ENV['HOME'].to_s == Pathname.new(path).expand_path.realpath.to_s
    return false, "Please DO NOT use your HOME folder as your Specified Source path! Try to use other paths, sub-paths, like ~/mywork, etc."
 end
 # FIXME: consider using http://ruby-doc.org/stdlib-2.2.0/libdoc/timeout/rdoc/Timeout.html

The patching codes can be found here in my fork of OnDemand:

prod-feng@b03f091

Best,

Feng

@osc-bot osc-bot added this to the Backlog milestone Mar 16, 2024
@prod-feng
Copy link
Author

Follow up:

Added some more codes to handle more general situation when the DATAOOT is set.

#Check if the Source path is a subfolder of the OOD_DATAROOT. If so, stop it.

    if Pathname.new(ENV['OOD_DATAROOT']).fnmatch?(File.join(path,'**'))
       return false, "Please DO NOT use #{path} as the Source path! This will cause infinitive loop of files/paths copying when OOD stages the folder for your job. Please choose other path!"
    end

Please see the link here : cf4cb9b

@johrstrom
Copy link
Contributor

Thanks for the ticket and the followup. I'll take a look at this this week.

@johrstrom johrstrom added the bug Existing functionality not working as expected label Mar 29, 2024
@johrstrom johrstrom modified the milestones: Backlog, 4.0 Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing functionality not working as expected
Projects
None yet
Development

No branches or pull requests

3 participants