<div dir="ltr">And only that one directory, apparently:<div><br></div><div><div><font face="monospace">[vagrant@vagrant include]$ ../ls -lS</font></div><div><font face="monospace">total 40<br></font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 2655 Sep 29 16:05 config.h</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 758 Sep 28 17:12 print.h</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 371 Sep 28 16:29 helpers.h</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 306 Sep 28 17:13 sort.h</font></div><div><span style="font-family:monospace">-rw-r--r-- 1 vagrant 1000 278 Sep 19 23:58 ls.h</span><br></div></div><div><span style="font-family:monospace"><br></span></div><div>I made sure to include a 'hidden' file in include/ for testing purposes.</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 29, 2017 at 1:36 PM Jason Ajmo <<a href="mailto:jajmo@stevens.edu">jajmo@stevens.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Furthermore, it appears the bug only applies to the top-level directory.<div><br></div><div>i.e.:</div><div><div><font face="monospace">[vagrant@vagrant midterm]$ ./ls -lSR</font></div></div></div><div dir="ltr"><div><div><font face="monospace">total 216</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 1846 Sep 28 16:29 helpers.c</font></div></div></div><div dir="ltr"><div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 3912 Sep 29 17:35 sort.o</font></div></div></div><div dir="ltr"><div><div><font face="monospace">drwxr-xr-x 2 vagrant 1000 4096 Sep 25 17:18 include</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 566 Sep 28 17:00 GNUmakefile</font></div></div></div><div dir="ltr"><div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 3968 Sep 29 17:35 helpers.o</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 1515 Sep 29 17:26 print_recurse.c</font></div><div><font face="monospace">-rwxr-xr-x 1 vagrant 1000 22794 Sep 29 17:35 ls</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 2712 Sep 29 17:35 print_recurse.o</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 3128 Sep 29 17:35 print_dir.o</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 7504 Sep 29 17:35 ls.o</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 7044 Sep 29 16:56 print.c</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 6344 Sep 29 17:33 sort.c</font></div></div></div><div dir="ltr"><div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 3283 Sep 27 16:03 ls.c</font></div></div></div><div dir="ltr"><div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 1620 Sep 29 17:29 print_dir.c</font></div></div></div><div dir="ltr"><div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 1392 Sep 25 17:11 README</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 546 Sep 28 17:00 Makefile</font></div></div></div><div dir="ltr"><div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 11496 Sep 29 17:35 print.o</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">./include:</font></div><div><font face="monospace">total 40<br></font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 2655 Sep 29 16:05 config.h</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 758 Sep 28 17:12 print.h</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 371 Sep 28 16:29 helpers.h</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 306 Sep 28 17:13 sort.h</font></div><div><font face="monospace">-rw-r--r-- 1 vagrant 1000 278 Sep 19 23:58 ls.h</font></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 29, 2017 at 12:53 PM Jason Ajmo <<a href="mailto:jajmo@stevens.edu" target="_blank">jajmo@stevens.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for clarifying NetBSD vs. Unix.<div><br></div><div>I have verified the function is being executed, but I just found some more interesting behavior. I stuck a print statement in the block where it compares filesizes, and the output is interesting.</div><div><br></div><div>On NetBSD:</div><div><div>Comparing .test: 3 and print.o: 11496</div><div>Comparing helpers.c: 1846 and .test: 3</div><div>Comparing sort.o: 3720 and .test: 3</div><div>Comparing include: 4096 and .test: 3</div><div>Comparing GNUmakefile: 566 and .test: 3</div><div>Comparing helpers.o: 3968 and .test: 3</div><div>Comparing print_recurse.c: 1494 and .test: 3</div><div>Comparing ls: 22842 and .test: 3</div><div>Comparing print_recurse.o: 2848 and .test: 3</div><div>Comparing print_dir.o: 3256 and .test: 3</div><div>Comparing ls.o: 7504 and .test: 3</div><div>Comparing print.c: 7045 and .test: 3</div><div>Comparing sort.c: 6206 and .test: 3</div><div>Comparing ls.c: 3283 and .test: 3</div><div>Comparing print_dir.c: 1672 and .test: 3</div><div>Comparing README: 1392 and .test: 3</div><div>Comparing Makefile: 546 and .test: 3</div><div>Comparing print.o: 11496 and .test: 3</div></div><div><br></div><div>On Linux:</div><div><snip></div><div><div>Comparing include: 4096 and helpers.o: 4152</div><div>Comparing include: 4096 and print_recurse.o: 3112</div><div>Comparing print_dir.o: 3664 and print_recurse.o: 3112</div><div>Comparing helpers.c: 1846 and print_recurse.o: 3112</div><div>Comparing helpers.c: 1846 and print_recurse.c: 1494</div><div>Comparing .test: 3 and ls.o: 7888</div><div>Comparing print.c: 7045 and sort.c: 6206</div><div>Comparing ls.o: 7888 and print.c: 7045</div><div>Comparing .test: 3 and print.c: 7045</div><div>Comparing .test: 3 and sort.c: 6206</div><div>Comparing ls.c: 3283 and print_dir.c: 1672</div><div>Comparing Makefile: 546 and print.o: 12800</div><div>Comparing README: 1392 and print.o: 12800</div><div>Comparing README: 1392 and Makefile: 546</div><div>Comparing ls.c: 3283 and print.o: 12800</div><div>Comparing ls.c: 3283 and README: 1392</div><div>Comparing print_dir.c: 1672 and README: 1392</div></div><div><snip></div><div><br></div><div>So now it's clear why it's not sorting properly. On NetBSD the size is always being compared to 3, the size of the test 'hidden' file. But I have no idea why...</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 29, 2017 at 12:17 PM Jan Schaumann <<a href="mailto:jschauma@stevens.edu" target="_blank">jschauma@stevens.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Jason Ajmo <<a href="mailto:jajmo@stevens.edu" target="_blank">jajmo@stevens.edu</a>> wrote:<br>
> Code: <a href="https://gist.github.com/jajmo/5e4e7827fd5b52549132a6a6364c4e53" rel="noreferrer" target="_blank">https://gist.github.com/jajmo/5e4e7827fd5b52549132a6a6364c4e53</a><br>
> The following are sorted based on filesize, descending (ls -lS)<br>
> On Linux, the objects are linked with -lbsd, and include bsd/bsd.h.<br>
><br>
> Output on Unix:<br>
<br>
I think you mean 'NetBSD', which is a Unix-like OS.<br>
<a href="https://en.wikipedia.org/wiki/Unix-like" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Unix-like</a><br>
<br>
> [vagrant@vagrant midterm]$ ./ls -lS<br>
> total 216<br>
> -rw-r--r-- 1 vagrant 1000 1846 Sep 28 16:29 helpers.c<br>
> -rw-r--r-- 1 vagrant 1000 3376 Sep 29 15:59 sort.o<br>
<br>
Weird. Looks like no sorting is taking place at all. Have you<br>
confirmed that the code block you think is being executed is in fact<br>
being executed?<br>
<br>
-Jan<br>
_______________________________________________<br>
cs631apue mailing list<br>
<a href="mailto:cs631apue@lists.stevens.edu" target="_blank">cs631apue@lists.stevens.edu</a><br>
<a href="https://lists.stevens.edu/mailman/listinfo/cs631apue" rel="noreferrer" target="_blank">https://lists.stevens.edu/mailman/listinfo/cs631apue</a><br>
</blockquote></div><div dir="ltr">-- <br></div><div class="m_-4617137136930255320m_-1426071973187555069gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Jason Ajmo</div><div>Stevens Institute of Technology</div><div>B.S. Cybersecurity '17</div><div>M.S. Computer Science '18</div><div>0x56FA3123</div></div></div></blockquote></div><div dir="ltr">-- <br></div><div class="m_-4617137136930255320gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Jason Ajmo</div><div>Stevens Institute of Technology</div><div>B.S. Cybersecurity '17</div><div>M.S. Computer Science '18</div><div>0x56FA3123</div></div></div></blockquote></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Jason Ajmo</div><div>Stevens Institute of Technology</div><div>B.S. Cybersecurity '17</div><div>M.S. Computer Science '18</div><div>0x56FA3123</div></div></div>