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

Definition of stage_file function in C++ #4733

Closed
jellythefish opened this issue Apr 27, 2022 · 8 comments · Fixed by #4816
Closed

Definition of stage_file function in C++ #4733

jellythefish opened this issue Apr 27, 2022 · 8 comments · Fixed by #4816

Comments

@jellythefish
Copy link
Contributor

jellythefish commented Apr 27, 2022

There is a binary executable for staging input files and it is written in php.
https://github.com/BOINC/boinc/blob/master/tools/stage_file

In projects we usually use this tool like bin/stage_file

But for my needs i was searching for such API in C++ and was able to find only declaration in bachend_lib.h:

extern int stage_file(const char*, bool);

It has got no definition in bachend_lib.cpp or somewhere else across the repository.

Is this a work in progress or may it be a feature request?

@jellythefish jellythefish changed the title Definition for stage_file function in C++ Definition of stage_file function in C++ Apr 27, 2022
@AenBleidd
Copy link
Member

@davidpanderson, this function declaration was added in c529c3c
but I don't see it was ever implemented.
Is this a leftover that should be deleted?

@davidpanderson
Copy link
Contributor

Looks like I intended to implement stage_file() in C++ but didn't get around to it.
At this point it's probably easiest to use system() to run the PHP script from C++.

@jellythefish
Copy link
Contributor Author

I may try to make one based on PHP implementation.
Is it ok and will you have an opportunity to review?

@davidpanderson
Copy link
Contributor

By all means! Let me know if you need any help or advice.

@jellythefish
Copy link
Contributor Author

jellythefish commented Jun 25, 2022

@davidpanderson, @AenBleidd
Hi there! I made some stuff over there as we discussed #4816
There are some things i am confused about.
I tried to make both the tool - executable binary and the library function.
I am not sure whether the signature of the lib func is ok with the arguments passed to the tool.
Also, not sure wheter i return error codes and print errors to stderr correctly. There are also some concerns about general code style and its C/C++ mixing.
Will be very thankful if you review and make some comments and issues.

@AenBleidd
Copy link
Member

Hello @jellythefish, thank you for your PR.
I'll take a look at the code.

@davidpanderson
Copy link
Contributor

Unless efficiency is an issue, I'd recommend invoking the PHP script from C++ using system(). In any case, don't change the name of stage_file since that will break some projects.

@jellythefish
Copy link
Contributor Author

jellythefish commented Jun 29, 2022

Unless efficiency is an issue, I'd recommend invoking the PHP script from C++ using system(). In any case, don't change the name of stage_file since that will break some projects.

Ok, i'll change the name of stage_file back to .php version, actually agree with you. Just thought it would be kind of uniform to use my c++ lib functions and tool as it is usually done in BOINC. I tried to make totally same function behavior as in .php, but just in case will leave this script default in usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
3 participants