【问题标题】:Why can Perforce not set environment variables on Linux?为什么 Perforce 不能在 Linux 上设置环境变量?
【发布时间】:2015-10-06 20:57:35
【问题描述】:

我试图按照 Perforce 网站上this post 中的步骤设置 P4IGNORE 文件。

在 Linux 上,运行

p4 set P4IGNORE=.ignore

导致以下错误信息:

Perforce client warning:
    Can't set registry on UNIX.

阅读p4 set的帮助条目,似乎它只能用于在Windows和Mac OS X上设置Perforce变量。在Linux上,我不得不使用本机shell命令,即

export P4IGNORE=.ignore

我的问题是 - 为什么 p4 set 命令在 Linux 上不起作用,当它同时为 Windows 和 OS X(也是基于 Unix)实现时?

【问题讨论】:

  • Linux 没有注册表。
  • 我怀疑我已经知道这个问题的答案,并会根据我的猜测发布答案,但是您使用的是什么版本的客户端? (p4 -V)
  • 嗨 Sam - 我使用的是 2014.1,因此只需从更新中删除一个版本即可解决问题。我无法控制项目中使用的版本,但很高兴知道现在存在解决方法。
  • 这是客户端功能,因此您只需要更新自己机器 (p4) 上的二进制文件,而不是服务器 (p4d)。

标签: linux environment-variables perforce


【解决方案1】:

升级到最新版本的 p4 CLI(或至少 2014.2 版):

Major new functionality in 2014.2

    Other platforms, such as Linux, will now set an environment
    file.  The environment file is available on all platforms
    if a P4ENVIRO environment variable is set to a file path.
    P4ENVIRO will default to a file '.p4enviro' in the user's
    home directory for systems which do not have system provided
    facilities.  The p4 enviro file can be shared across platforms.
    The 'p4 set' command can be used to manipulate or inspect
    this new environment facility.  Note that these special
    'P4_<p4port>_CHARSET' values will only appear in 'p4 set'
    output for the specified or current P4PORT value.
    For instance 'p4 -p perforce:4666 set' will report on
    'P4_perforce:4666_CHARSET' if it is set.

http://www.perforce.com/perforce/doc.current/user/relnotes.txt

【讨论】:

  • “p4 -V”是什么意思,“p4 set (whatever)”是什么意思?
【解决方案2】:

在 Windows 上,p4 set 会更新注册表。在 OS X 上,p4 set 更新用户首选项文件。

Linux 上没有注册表或首选项,因此使用环境变量作为默认值。 p4 set 不可能更新父 shell 的环境变量,更不用说使它们永久化了。您需要编辑其中一个 shell 启动文件来设置环境变量。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-07
    • 2015-02-14
    • 1970-01-01
    • 2022-11-20
    • 1970-01-01
    • 2010-10-17
    相关资源
    最近更新 更多