Skip to content

Commit ee799d9

Browse files
committed
Simplify $HOME manipulation in cvd start --help
When forbidding the presence of the '~' path component and using basically the default values for most of the parameters, EmulateAbsolutePath is no different than AbsolutePath.
1 parent 11b2af0 commit ee799d9

1 file changed

Lines changed: 1 addition & 21 deletions

File tree

  • base/cvd/cuttlefish/host/commands/cvd/cli/commands

base/cvd/cuttlefish/host/commands/cvd/cli/commands/start.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -540,27 +540,7 @@ Result<std::string> CvdStartCommandHandler::DetailedHelp(
540540
if (envs["HOME"].empty()) {
541541
envs.erase("HOME");
542542
} else {
543-
// As the end-user may override HOME, this could be a relative path
544-
// to client's pwd, or may include "~" which is the client's actual
545-
// home directory.
546-
auto client_pwd = CurrentDirectory();
547-
const auto given_home_dir = envs.at("HOME");
548-
/*
549-
* Imagine this scenario:
550-
* client$ export HOME=/tmp/new/dir
551-
* client$ HOME="~/subdir" cvd start
552-
*
553-
* The value of ~ isn't sent to the server. The server can't figure that
554-
* out as it might be overridden before the cvd start command.
555-
*/
556-
CF_EXPECT(!absl::StartsWith(given_home_dir, "~") &&
557-
!absl::StartsWith(given_home_dir, "~/"),
558-
"The HOME directory should not start with ~");
559-
envs["HOME"] = CF_EXPECT(
560-
EmulateAbsolutePath({.current_working_dir = client_pwd,
561-
.home_dir = CF_EXPECT(SystemWideUserHome()),
562-
.path_to_convert = given_home_dir,
563-
.follow_symlink = false}));
543+
envs["HOME"] = AbsolutePath(envs.at("HOME"));
564544
}
565545
}
566546
auto android_host_out =

0 commit comments

Comments
 (0)