Summary: | ulimit -H does not change soft limit | ||
---|---|---|---|
Product: | Sisyphus | Reporter: | Sergey Vlasov <vsu> |
Component: | bash | Assignee: | placeholder <placeholder> |
Status: | CLOSED NOTABUG | QA Contact: | qa-sisyphus |
Severity: | major | ||
Priority: | P2 | CC: | glebfm, inger, ldv, placeholder, voins |
Version: | unstable | ||
Hardware: | all | ||
OS: | Linux |
Description
Sergey Vlasov
2004-06-02 20:40:16 MSD
Unable to reproduce. strace output for bash: getrlimit(RLIMIT_AS, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0 getrlimit(RLIMIT_AS, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0 setrlimit(RLIMIT_AS, {rlim_cur=RLIM_INFINITY, rlim_max=2000000*1024}) = -1 EINVAL (Invalid argument) open("/usr/share/locale/ru_RU.KOI8-R/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/ru_RU.koi8r/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/ru_RU/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/ru.KOI8-R/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/ru.koi8r/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/ru/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "sh: line 1: ulimit: virtual memo"..., 74sh: line 1: ulimit: virtual memory: cannot modify limit: Invalid argument ) = 74 exit_group(1) = ? strace output for zsh: setrlimit(RLIMIT_AS, {rlim_cur=2000000*1024, rlim_max=2000000*1024}) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0 getpid() = 23961 exit_group(0) = ? Oops- про ulimit -Sv наврал - он работает. Как оказалось, 2.4.26-std-smp-alt2 ведёт себя точно так же: $ ulimit -Hv 500000 -bash: ulimit: virtual memory: cannot modify limit: Invalid argument strace: setrlimit(RLIMIT_AS, {rlim_cur=1048576*1024, rlim_max=500000*1024}) = -1 EINVAL (Invalid argument) Судя по http://www.opengroup.org/onlinepubs/007908799/xsh/getrlimit.html, ядро в данном случае ведёт себя правильно: The getrlimit() and setrlimit() functions will fail if: [EINVAL] An invalid resource was specified; or in a setrlimit() call, the new rlim_cur exceeds the new rlim_max. Это от ядра не зависит. Если сначала не выставить -Sv, то -Hv не сработает. Вопрос в том, что должна делать команда ulimit c soft limit'ом при установке hard limit'а, и должна ли вообще? См. тж.: $ ulimit -Sv 262144 $ ulimit -Hv 262144 $ ulimit -Hv 262143 bash: ulimit: virtual memory: cannot modify limit: Invalid argument Мда... очередной случай несовместимости shell-ов. bash: If neither -H nor -S is specified, both the soft and hard limits are set. zsh: By default, only soft limits are manipulated. Короче говоря, это не ошибка, а просто очередная особенность. Я убеждён, что поведение bash логичнее, чем избыточный интеллект zsh. Все присутствующие в данный момент в офисе со мной в этом согласны. Если надо установить оба лимита сразу, есть "ulimit -SH". Неплохо бы повесить PR на zsh. |