I have some scripts that invoke p4
commands. Since I want well-defined, predictable behavior, I do not want my script to invoke any aliases. That is, if my script invokes p4 FOO
, it should not invoke p4 BAR
, p4 FOO -x
, etc.
What is the proper way to disable aliases?
p4 help aliases
indicates that a P4ALIASES
environment variable can be used to override the .p4aliases
/p4aliases.txt
file. However, on my Linux system, P4ALIASES= p4 COMMAND
seems to have no effect; p4
(P4/LINUX26X86_64/2022.2/2407422) seems to treat an empty P4ALIASES
value to mean that it should continue using the default alias file. Setting P4ALIASES=/dev/null
does seem to work to disable aliases, though.
I also noticed that some of the online documentation mentions a p4 --aliases=dry-run
option. The --aliases
option is not mentioned in p4 help usage
nor in p4 help undoc
, so I don't know what arguments it accepts. p4 --aliases=none
does seem to work to disable aliases (and p4 --aliases=some_garbage_value
doesn't), but it'd be nice if there were something more official to confirm that that's the correct approach.
The source code is about as official an answer as you're likely to get:
const StrPtr *aliasHandling = opts[ Options::Aliases ];
if( aliasHandling && !strncmp( aliasHandling->Text(), "no", 2 ) )
hasAliasesDisabled = 1;
So --aliases=none
will indeed work to disable aliases, as will --aliases=nope
or --aliases=nobbled
. :)