bryancall commented on code in PR #13550:
URL: https://github.com/apache/trafficserver/pull/13550#discussion_r3786303107


##########
src/tscore/Layout.cc:
##########
@@ -161,15 +161,15 @@ Layout::Layout(std::string_view const _prefix)
       if ((len + 1) > PATH_NAME_MAX) {
         ink_fatal("TS_ROOT environment variable is too big: %d, max %d\n", 
len, PATH_NAME_MAX - 1);
       }
-      path = env_path;
+      path = std::move(env_path);
       while (path.back() == '/') {
         path.pop_back();
       }

Review Comment:
   This one is pre-existing rather than something this change introduces. The 
only edit here is `path = env_path` becoming `path = std::move(env_path)`; the 
`while (path.back() == '/')` loop above is untouched upstream code.
   
   You are right that it is a real problem though: with `TS_ROOT` set but 
empty, `getenv` returns a non-null empty string, so `path` is empty and 
`path.back()` is undefined. Since the goal of this pull request is to be 
provably free of behavior changes, I would rather not add a guard here and will 
raise it separately.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to