| Summary: | sbsize in /etc/login.conf is type number | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Paul Herman <pherman> | ||||
| Component: | conf | Assignee: | Sheldon Hearn <sheldonh> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.0-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: freebsd-bugs->sheldonh I'll take this one State Changed From-To: open->analyzed Committed as rev 1.25 of login.conf.5 and rev 1.15 of login_class.c, left as an MFC reminder. If the src tree isn't already frozen by then, I'll MFC this before 4.1-RELEASE. State Changed From-To: analyzed->closed Merged onto the RELENG_4 branch in time for 4.1-RELEASE. On Fri, 7 Jul 2000 pherman@frenchfries.net wrote: > >Description: > > sbsize in /etc/login.conf has type "number" instead of > "bytes". For example, if the administrator wishes to > set a 2 MB limit on sbsize, 2097152 works, but "2M" > gives an error at login. > > >How-To-Repeat: > > Try to use any size setting (i.e. "2M", "1024K", etc.) for sbsize. This PR might have to be reopened. This used to work, but seems to be broken again: 07:57:22{{ttyp3}root@husten}~//> grep sbsize /etc/login.conf :sbsize=4096K:\ 07:57:33{{ttyp3}root@husten}~//> limits -U pherman | grep sbsize sbsize 4096 bytes Strange thing is, login_cap.c & login_class.c haven't been touched in a while, so I can't seem to track this down. Running cap_mkdb(1) doesn't help. I noticed this after upgrading a customer's machine to 4.3-RELEASE and their FTP sessions would break -- they had 8 bytes of sbsize all of a sudden, instead of 8M given in /etc/login.conf. Workaround was to set sbsize=8192000. Any ideas? -Paul. (Sheldon Cc'ed, because he took this originally.)
I know this was closed a long time ago, but I just noticed there's a
file that forgot to get patched.
/usr/bin/limits -U [user] almost always out an incorrect value for
sbsize. The following patch against should fix this.
Thanks,
-Paul.
Index: limits.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/limits/limits.c,v
retrieving revision 1.7.2.1
diff -u -r1.7.2.1 limits.c
--- limits.c 2000/07/02 09:50:17 1.7.2.1
+++ limits.c 2001/05/04 18:48:11
@@ -200,7 +200,7 @@
{ "memorylocked", login_getcapsize },
{ "maxproc", login_getcapnum },
{ "openfiles", login_getcapnum },
- { "sbsize", login_getcapnum }
+ { "sbsize", login_getcapsize }
};
/*
On Mon, 07 May 2001 19:53:24 +0200, Paul Herman wrote:
> /usr/bin/limits -U [user] almost always out an incorrect value for
> sbsize. The following patch against should fix this.
Committed. However, shouldn't the units for sbsize be "kb" instead of
"bytes", as suggested by the patch below?
Ciao,
Sheldon.
Index: limits.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/limits/limits.c,v
retrieving revision 1.9
diff -u -d -r1.9 limits.c
--- limits.c 2001/05/10 17:15:06 1.9
+++ limits.c 2001/05/10 18:08:22
@@ -83,7 +83,7 @@
{ " memorylocked%-4s %8s", " kb\n", 1024 },
{ " maxprocesses%-4s %8s", "\n", 1 },
{ " openfiles%-4s %8s", "\n", 1 },
- { " sbsize%-4s %8s", " bytes\n", 1 }
+ { " sbsize%-4s %8s", " kb\n", 1024 }
}
},
{ "sh", "unlimited", "", " -H", " -S", "",
@@ -97,7 +97,7 @@
{ "ulimit%s -l %s", ";\n", 1024 },
{ "ulimit%s -u %s", ";\n", 1 },
{ "ulimit%s -n %s", ";\n", 1 },
- { "ulimit%s -b %s", ";\n", 1 }
+ { "ulimit%s -b %s", ";\n", 1024 }
}
},
{ "csh", "unlimited", "", " -h", "", NULL,
@@ -111,7 +111,7 @@
{ "limit%s memorylocked %s", ";\n", 1024 },
{ "limit%s maxproc %s", ";\n", 1 },
{ "limit%s openfiles %s", ";\n", 1 },
- { "limit%s sbsize %s", ";\n", 1 }
+ { "limit%s sbsize %s", ";\n", 1024 }
}
},
{ "bash|bash2", "unlimited", "", " -H", " -S", "",
@@ -125,7 +125,7 @@
{ "ulimit%s -l %s", ";\n", 1024 },
{ "ulimit%s -u %s", ";\n", 1 },
{ "ulimit%s -n %s", ";\n", 1 },
- { "ulimit%s -b %s", ";\n", 1 }
+ { "ulimit%s -b %s", ";\n", 1024 }
}
},
{ "tcsh", "unlimited", "", " -h", "", NULL,
@@ -139,7 +139,7 @@
{ "limit%s memorylocked %s", ";\n", 1024 },
{ "limit%s maxproc %s", ";\n", 1 },
{ "limit%s descriptors %s", ";\n", 1 },
- { "limit%s sbsize %s", ";\n", 1 }
+ { "limit%s sbsize %s", ";\n", 1024 }
}
},
{ "ksh|pdksh", "unlimited", "", " -H", " -S", "",
@@ -153,7 +153,7 @@
{ "ulimit%s -l %s", ";\n", 1024 },
{ "ulimit%s -p %s", ";\n", 1 },
{ "ulimit%s -n %s", ";\n", 1 },
- { "ulimit%s -b %s", ";\n", 1 }
+ { "ulimit%s -b %s", ";\n", 1024 }
}
},
{ "zsh", "unlimited", "", " -H", " -S", "",
@@ -167,7 +167,7 @@
{ "ulimit%s -l %s", ";\n", 1024 },
{ "ulimit%s -u %s", ";\n", 1 },
{ "ulimit%s -n %s", ";\n", 1 },
- { "ulimit%s -b %s", ";\n", 1 }
+ { "ulimit%s -b %s", ";\n", 1024 }
}
},
{ "rc|es", "unlimited", "", " -h", "", NULL,
@@ -181,7 +181,7 @@
{ "limit%s lockedmemory %s", ";\n", 1024 },
{ "limit%s processes %s", ";\n", 1 },
{ "limit%s descriptors %s", ";\n", 1 },
- { "limit%s sbsize %s", ";\n", 1 }
+ { "limit%s sbsize %s", ";\n", 1024 }
}
},
{ NULL }
On Thu, 10 May 2001, Sheldon Hearn wrote: > On Mon, 07 May 2001 19:53:24 +0200, Paul Herman wrote: > > > /usr/bin/limits -U [user] almost always out an incorrect value for > > sbsize. The following patch against should fix this. > > Committed. However, shouldn't the units for sbsize be "kb" instead of > "bytes", as suggested by the patch below? One thing I might take issue with is the -b option to ulimit. At the moment, /bin/sh seems to take bytes, not kbytes. So, if you commit your patch, be sure to commit the following patch to /bin/sh so that it's "ulimit -b" also takes kbytes. Otherwise, looks good to me. Thanks! -Paul. Index: miscbltin.c =================================================================== RCS file: /home/ncvs/src/bin/sh/miscbltin.c,v retrieving revision 1.22.2.1 diff -u -r1.22.2.1 miscbltin.c --- miscbltin.c 2000/06/14 13:42:25 1.22.2.1 +++ miscbltin.c 2001/05/10 22:46:17 @@ -347,7 +347,7 @@ { "swap limit", "kbytes", RLIMIT_SWAP, 1024, 'w' }, #endif #ifdef RLIMIT_SBSIZE - { "sbsize", "bytes", RLIMIT_SBSIZE, 1, 'b' }, + { "sbsize", "bytes", RLIMIT_SBSIZE, 1024, 'b' }, #endif { (char *) 0, (char *)0, 0, 0, '\0' } }; |
sbsize in /etc/login.conf has type "number" instead of "bytes". For example, if the administrator wishes to set a 2 MB limit on sbsize, 2097152 works, but "2M" gives an error at login. Fix: Patch for libutil (tested for about 5 minutes, seems to work :) How-To-Repeat: Try to use any size setting (i.e. "2M", "1024K", etc.) for sbsize.