可以“文本文件繁忙"吗?两个进程试图同时执行一个perl文件时会发生什么情况? [英] Can "Text file busy" happen when two processes trying to execute a perl file in the same time?

查看:96
本文介绍了可以“文本文件繁忙"吗?两个进程试图同时执行一个perl文件时会发生什么情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当此文件当前正在被另一个进程使用时,当我尝试执行一个perl文件时,我收到此消息-文本文件忙".

I got this message - "Text file busy" when I try to execute a perl file while this file is currently being used by another processes.

根据以下/usr/bin/perl:错误的解释器:文本文件忙,当我尝试执行perl文件以进行写入时,会发生此问题.

According to this /usr/bin/perl: bad interpreter: Text file busy, this problem happens when the perl file is open for writing when I try to execute it.

但是文件的许可权是-r-xr-xr-x.它不提供写权限.

But the file's permission is -r-xr-xr-x. It does not provide permissions to write.

当两个进程试图同时执行一个perl文件时,是否会发生文本文件繁忙"?

Can "Text file busy" happen when two processes trying to execute a perl file in the same time?

推荐答案

不,这不会仅仅因为两个Perl脚本同时执行而发生.

No, this won't happen simply because two Perl scripts are executing at the same time.

更可能的解释是,脚本本身是开放的,可以在操作系统尝试读取其shebang行以确定要使用的解释器时进行编写.

The more likely explanation is that the script itself is open for write while the operating system is trying to read its shebang line to determine the interpreter to use.

如果外部进程试图升级或修改Perl解释器本身或它依赖的共享库之一,也会发生这种情况.请注意,文件权限通常不适用于超级用户帐户(例如root),因此,即使未设置+w位,以超级用户身份运行的任何进程仍可以尝试修改Perl解释器.

This can also happen if an external process is trying to upgrade or modify the Perl interpreter itself, or one of the shared libraries it depends on. Note that file permissions don't generally apply to superuser accounts, such as root, so any process running as superuser can still attempt to modify the Perl interpreter despite there being no +w bits set.

(也就是说,大多数行为良好的POSIX风格的操作系统升级工具会将二进制文件的升级版本写入同一文件系统上的新文件中,完成后关闭该文件,然后将其重命名为原始文件. (原子操作)-这样,在/usr/bin/perl处附加的inode本身就永远不会打开以进行写操作,因此,在一个性能良好的系统上,您看到的错误实际上是不应该出现的).

(That said, most well-behaved operating system upgrade tools on POSIX-style operating systems will write the upgraded version of a binary to a new file on the same filesystem, close that file when done, and rename it over the original (an atomic operation) -- such that the inode attached at /usr/bin/perl is itself never open for write. As such, on a well-behaved system, the error you're seeing isn't something that should ever come up in practice).

您可以使用fuser命令查看谁为您的脚本或其解释程序打开了文件:

You can use the fuser command to see who has a file open, either for your script or for its interpreter:

$ sudo fuser /usr/bin/perl -uv
                     USER        PID ACCESS COMMAND
/usr/bin/perl:       root      16579 f.... (root)python

这篇关于可以“文本文件繁忙"吗?两个进程试图同时执行一个perl文件时会发生什么情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆