Get maximum level of symlinks

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite
1












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.







share|improve this question






















  • See also this question (which I’m not suggesting as a duplicate to avoid the hammer).
    – Stephen Kitt
    Nov 4 '17 at 18:56














up vote
3
down vote

favorite
1












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.







share|improve this question






















  • See also this question (which I’m not suggesting as a duplicate to avoid the hammer).
    – Stephen Kitt
    Nov 4 '17 at 18:56












up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





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.







share|improve this question














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.









share|improve this question













share|improve this question




share|improve this question








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
















  • 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










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





share|improve this answer




















  • 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 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










  • On my OpenBSD system, I can do getconf SYMLOOP_MAX to get back "32".
    – Kusalananda
    Nov 4 '17 at 19:47










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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





share|improve this answer




















  • 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 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










  • On my OpenBSD system, I can do getconf SYMLOOP_MAX to get back "32".
    – Kusalananda
    Nov 4 '17 at 19:47














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





share|improve this answer




















  • 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 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










  • On my OpenBSD system, I can do getconf SYMLOOP_MAX to get back "32".
    – Kusalananda
    Nov 4 '17 at 19:47












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





share|improve this answer












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






share|improve this answer












share|improve this answer



share|improve this answer










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 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










  • On my OpenBSD system, I can do getconf 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






  • 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 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










  • On my OpenBSD system, I can do getconf 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

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?