Get maximum level of symlinks
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I would like to get the number of maximum possible symlink level in the system. I found that it is hardcoded in the kernel to be 40. But I would like to get this number dynamically, in case someone changes this in the source code and recompiles the kernel. Is this even possible? And if not, how bad idea it is to assume this number to be always 40?
Thanks.
linux symlink
add a comment |Â
up vote
3
down vote
favorite
I would like to get the number of maximum possible symlink level in the system. I found that it is hardcoded in the kernel to be 40. But I would like to get this number dynamically, in case someone changes this in the source code and recompiles the kernel. Is this even possible? And if not, how bad idea it is to assume this number to be always 40?
Thanks.
linux symlink
See also this question (which IâÂÂm not suggesting as a duplicate to avoid the hammer).
â Stephen Kitt
Nov 4 '17 at 18:56
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I would like to get the number of maximum possible symlink level in the system. I found that it is hardcoded in the kernel to be 40. But I would like to get this number dynamically, in case someone changes this in the source code and recompiles the kernel. Is this even possible? And if not, how bad idea it is to assume this number to be always 40?
Thanks.
linux symlink
I would like to get the number of maximum possible symlink level in the system. I found that it is hardcoded in the kernel to be 40. But I would like to get this number dynamically, in case someone changes this in the source code and recompiles the kernel. Is this even possible? And if not, how bad idea it is to assume this number to be always 40?
Thanks.
linux symlink
edited Nov 4 '17 at 19:03
asked Nov 4 '17 at 17:26
karlosss
20416
20416
See also this question (which IâÂÂm not suggesting as a duplicate to avoid the hammer).
â Stephen Kitt
Nov 4 '17 at 18:56
add a comment |Â
See also this question (which IâÂÂm not suggesting as a duplicate to avoid the hammer).
â Stephen Kitt
Nov 4 '17 at 18:56
See also this question (which IâÂÂm not suggesting as a duplicate to avoid the hammer).
â Stephen Kitt
Nov 4 '17 at 18:56
See also this question (which IâÂÂm not suggesting as a duplicate to avoid the hammer).
â Stephen Kitt
Nov 4 '17 at 18:56
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
touch file
test_max=45
for ((j=2,i=3;i<test_max;i++,j++)) ; do ln -s $j $i; done
for ((i=1;i<test_max;i++)) ; do if ! [ -f "$i" ]; then echo "$i"; break; fi ; done
41
Is this really the only option?
â karlosss
Nov 4 '17 at 17:46
1
@karlosss That is not my claim. I wasn't even aware of the problem until I read your question. That was my spontaneous idea how to get that information. But it may be available somewhere explicitly (I didn't find anything in/proc/sys/kernel/
, though).
â Hauke Laging
Nov 4 '17 at 18:32
1
The closest you can get isecho -n "#include <sys/param.h>nMAXSYMLINKS" | gcc -E -
, but that gives the C libraryâÂÂs version, not the kernelâÂÂs (20 v. 40). ThereâÂÂs nothing ingetconf
. Some Unix systems had this as a kernel tunable (fs_symlinks
IIRC on HP-UX).
â Stephen Kitt
Nov 4 '17 at 18:53
I am still hoping (yeah, the probability is very low) that we are all missing something and somebody will come with a shell variable or a file containing this value. I would like to avoid thegcc
solution as well.
â karlosss
Nov 4 '17 at 19:03
On my OpenBSD system, I can dogetconf SYMLOOP_MAX
to get back "32".
â Kusalananda
Nov 4 '17 at 19:47
 |Â
show 2 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
touch file
test_max=45
for ((j=2,i=3;i<test_max;i++,j++)) ; do ln -s $j $i; done
for ((i=1;i<test_max;i++)) ; do if ! [ -f "$i" ]; then echo "$i"; break; fi ; done
41
Is this really the only option?
â karlosss
Nov 4 '17 at 17:46
1
@karlosss That is not my claim. I wasn't even aware of the problem until I read your question. That was my spontaneous idea how to get that information. But it may be available somewhere explicitly (I didn't find anything in/proc/sys/kernel/
, though).
â Hauke Laging
Nov 4 '17 at 18:32
1
The closest you can get isecho -n "#include <sys/param.h>nMAXSYMLINKS" | gcc -E -
, but that gives the C libraryâÂÂs version, not the kernelâÂÂs (20 v. 40). ThereâÂÂs nothing ingetconf
. Some Unix systems had this as a kernel tunable (fs_symlinks
IIRC on HP-UX).
â Stephen Kitt
Nov 4 '17 at 18:53
I am still hoping (yeah, the probability is very low) that we are all missing something and somebody will come with a shell variable or a file containing this value. I would like to avoid thegcc
solution as well.
â karlosss
Nov 4 '17 at 19:03
On my OpenBSD system, I can dogetconf SYMLOOP_MAX
to get back "32".
â Kusalananda
Nov 4 '17 at 19:47
 |Â
show 2 more comments
up vote
1
down vote
touch file
test_max=45
for ((j=2,i=3;i<test_max;i++,j++)) ; do ln -s $j $i; done
for ((i=1;i<test_max;i++)) ; do if ! [ -f "$i" ]; then echo "$i"; break; fi ; done
41
Is this really the only option?
â karlosss
Nov 4 '17 at 17:46
1
@karlosss That is not my claim. I wasn't even aware of the problem until I read your question. That was my spontaneous idea how to get that information. But it may be available somewhere explicitly (I didn't find anything in/proc/sys/kernel/
, though).
â Hauke Laging
Nov 4 '17 at 18:32
1
The closest you can get isecho -n "#include <sys/param.h>nMAXSYMLINKS" | gcc -E -
, but that gives the C libraryâÂÂs version, not the kernelâÂÂs (20 v. 40). ThereâÂÂs nothing ingetconf
. Some Unix systems had this as a kernel tunable (fs_symlinks
IIRC on HP-UX).
â Stephen Kitt
Nov 4 '17 at 18:53
I am still hoping (yeah, the probability is very low) that we are all missing something and somebody will come with a shell variable or a file containing this value. I would like to avoid thegcc
solution as well.
â karlosss
Nov 4 '17 at 19:03
On my OpenBSD system, I can dogetconf SYMLOOP_MAX
to get back "32".
â Kusalananda
Nov 4 '17 at 19:47
 |Â
show 2 more comments
up vote
1
down vote
up vote
1
down vote
touch file
test_max=45
for ((j=2,i=3;i<test_max;i++,j++)) ; do ln -s $j $i; done
for ((i=1;i<test_max;i++)) ; do if ! [ -f "$i" ]; then echo "$i"; break; fi ; done
41
touch file
test_max=45
for ((j=2,i=3;i<test_max;i++,j++)) ; do ln -s $j $i; done
for ((i=1;i<test_max;i++)) ; do if ! [ -f "$i" ]; then echo "$i"; break; fi ; done
41
answered Nov 4 '17 at 17:44
Hauke Laging
53.6k1282130
53.6k1282130
Is this really the only option?
â karlosss
Nov 4 '17 at 17:46
1
@karlosss That is not my claim. I wasn't even aware of the problem until I read your question. That was my spontaneous idea how to get that information. But it may be available somewhere explicitly (I didn't find anything in/proc/sys/kernel/
, though).
â Hauke Laging
Nov 4 '17 at 18:32
1
The closest you can get isecho -n "#include <sys/param.h>nMAXSYMLINKS" | gcc -E -
, but that gives the C libraryâÂÂs version, not the kernelâÂÂs (20 v. 40). ThereâÂÂs nothing ingetconf
. Some Unix systems had this as a kernel tunable (fs_symlinks
IIRC on HP-UX).
â Stephen Kitt
Nov 4 '17 at 18:53
I am still hoping (yeah, the probability is very low) that we are all missing something and somebody will come with a shell variable or a file containing this value. I would like to avoid thegcc
solution as well.
â karlosss
Nov 4 '17 at 19:03
On my OpenBSD system, I can dogetconf SYMLOOP_MAX
to get back "32".
â Kusalananda
Nov 4 '17 at 19:47
 |Â
show 2 more comments
Is this really the only option?
â karlosss
Nov 4 '17 at 17:46
1
@karlosss That is not my claim. I wasn't even aware of the problem until I read your question. That was my spontaneous idea how to get that information. But it may be available somewhere explicitly (I didn't find anything in/proc/sys/kernel/
, though).
â Hauke Laging
Nov 4 '17 at 18:32
1
The closest you can get isecho -n "#include <sys/param.h>nMAXSYMLINKS" | gcc -E -
, but that gives the C libraryâÂÂs version, not the kernelâÂÂs (20 v. 40). ThereâÂÂs nothing ingetconf
. Some Unix systems had this as a kernel tunable (fs_symlinks
IIRC on HP-UX).
â Stephen Kitt
Nov 4 '17 at 18:53
I am still hoping (yeah, the probability is very low) that we are all missing something and somebody will come with a shell variable or a file containing this value. I would like to avoid thegcc
solution as well.
â karlosss
Nov 4 '17 at 19:03
On my OpenBSD system, I can dogetconf SYMLOOP_MAX
to get back "32".
â Kusalananda
Nov 4 '17 at 19:47
Is this really the only option?
â karlosss
Nov 4 '17 at 17:46
Is this really the only option?
â karlosss
Nov 4 '17 at 17:46
1
1
@karlosss That is not my claim. I wasn't even aware of the problem until I read your question. That was my spontaneous idea how to get that information. But it may be available somewhere explicitly (I didn't find anything in
/proc/sys/kernel/
, though).â Hauke Laging
Nov 4 '17 at 18:32
@karlosss That is not my claim. I wasn't even aware of the problem until I read your question. That was my spontaneous idea how to get that information. But it may be available somewhere explicitly (I didn't find anything in
/proc/sys/kernel/
, though).â Hauke Laging
Nov 4 '17 at 18:32
1
1
The closest you can get is
echo -n "#include <sys/param.h>nMAXSYMLINKS" | gcc -E -
, but that gives the C libraryâÂÂs version, not the kernelâÂÂs (20 v. 40). ThereâÂÂs nothing in getconf
. Some Unix systems had this as a kernel tunable (fs_symlinks
IIRC on HP-UX).â Stephen Kitt
Nov 4 '17 at 18:53
The closest you can get is
echo -n "#include <sys/param.h>nMAXSYMLINKS" | gcc -E -
, but that gives the C libraryâÂÂs version, not the kernelâÂÂs (20 v. 40). ThereâÂÂs nothing in getconf
. Some Unix systems had this as a kernel tunable (fs_symlinks
IIRC on HP-UX).â Stephen Kitt
Nov 4 '17 at 18:53
I am still hoping (yeah, the probability is very low) that we are all missing something and somebody will come with a shell variable or a file containing this value. I would like to avoid the
gcc
solution as well.â karlosss
Nov 4 '17 at 19:03
I am still hoping (yeah, the probability is very low) that we are all missing something and somebody will come with a shell variable or a file containing this value. I would like to avoid the
gcc
solution as well.â karlosss
Nov 4 '17 at 19:03
On my OpenBSD system, I can do
getconf SYMLOOP_MAX
to get back "32".â Kusalananda
Nov 4 '17 at 19:47
On my OpenBSD system, I can do
getconf SYMLOOP_MAX
to get back "32".â Kusalananda
Nov 4 '17 at 19:47
 |Â
show 2 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402533%2fget-maximum-level-of-symlinks%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
See also this question (which IâÂÂm not suggesting as a duplicate to avoid the hammer).
â Stephen Kitt
Nov 4 '17 at 18:56