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

client and docker_wrapper: lower-case image and container names #6033

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/app_ipc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "filesys.h"
#include "miofile.h"
#include "parse.h"
#include "str_replace.h"
#include "str_util.h"
#include "url.h"
#include "util.h"
Expand Down
2 changes: 2 additions & 0 deletions lib/str_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <vector>
#include <string.h>

#include "str_replace.h"

#define safe_strcpy(x, y) strlcpy(x, y, sizeof(x))
#define safe_strcat(x, y) strlcat(x, y, sizeof(x))

Expand Down
4 changes: 3 additions & 1 deletion lib/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,10 @@ void escape_url(string& url) {
url = buf;
}

// Escape a URL for the project directory, cutting off the "http://",
// Escape a project URL, cutting off the "http://",
// converting everthing other than alphanumbers, ., - and _ to "_".
// This is used as the project directory name.
// Note: does not convert to lowercase.
//
void escape_url_readable(char *in, char* out) {
int x, y;
Expand Down
25 changes: 20 additions & 5 deletions lib/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#if defined(_WIN32)
#include "boinc_win.h"
#include "str_replace.h"
#include "str_util.h"
#include "win_util.h"
#endif
Expand Down Expand Up @@ -798,16 +797,32 @@ int DOCKER_CONN::parse_container_name(string line, string &name) {
string docker_image_name(
const char* proj_url_esc, const char* wu_name
) {
char buf[1024];
sprintf(buf, "boinc__%s__%s", proj_url_esc, wu_name);
char buf[1024], url_buf[1024], wu_buf[1024];;

// Docker image names can't have upper case chars
//
safe_strcpy(url_buf, proj_url_esc);
downcase_string(url_buf);
safe_strcpy(wu_buf, wu_name);
downcase_string(wu_buf);

sprintf(buf, "boinc__%s__%s", url_buf, wu_buf);
return string(buf);
}

string docker_container_name(
const char* proj_url_esc, const char* result_name
){
char buf[1024];
sprintf(buf, "boinc__%s__%s", proj_url_esc, result_name);
char buf[1024], url_buf[1024], result_buf[1024];;

// Docker image names can't have upper case chars
//
safe_strcpy(url_buf, proj_url_esc);
downcase_string(url_buf);
safe_strcpy(result_buf, result_name);
downcase_string(result_buf);

sprintf(buf, "boinc__%s__%s", url_buf, result_buf);
return string(buf);
}

Expand Down
Loading