Code Monkey home page Code Monkey logo

Comments (37)

jarun avatar jarun commented on September 21, 2024 1

OK. I've changed to i386.

from nnn.

jarun avatar jarun commented on September 21, 2024

I will check this. Thank you for the report.

from nnn.

jarun avatar jarun commented on September 21, 2024

Ahh, i386.

from nnn.

jarun avatar jarun commented on September 21, 2024

Can you please test if the following patch crashes at one of the files not shown?

diff --git a/nnn.c b/nnn.c
index 8eda2b3..b94ca40 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1784,9 +1784,10 @@ dentfill(char *path, struct entry **dents,
                        if ((namep[0] == '.' && (namep[1] == '\0' || (namep[1] == '.' && namep[2] == '\0'))))
                                continue;
 
-                       if (fstatat(fd, namep, &sb, AT_SYMLINK_NOFOLLOW)
-                                       == -1)
-                               continue;
+                       if (fstatat(fd, namep, &sb, AT_SYMLINK_NOFOLLOW) == -1) {
+                               DPRINTF_S(namep);
+                               errexit();
+                       }
 
                        if (S_ISDIR(sb.st_mode)) {
                                if (sb_path.st_dev == sb.st_dev) {
@@ -1816,7 +1817,7 @@ dentfill(char *path, struct entry **dents,
 
                if (fstatat(fd, namep, &sb, AT_SYMLINK_NOFOLLOW) == -1) {
                        DPRINTF_S(namep);
-                       continue;
+                       errexit();
                }
 
                if (n == total_dents) {

from nnn.

jarun avatar jarun commented on September 21, 2024

If it does, I believe we have to use stat64 versions instead of stat if the platform is i386.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Yes, it crashes.
line 1820: (75) Value too large for defined data type

from nnn.

jarun avatar jarun commented on September 21, 2024

Yes, that's because of the limitation of stat on i386. We have to use stat64 or something.

from nnn.

jarun avatar jarun commented on September 21, 2024

Now, please remove the older patch and try the following:

diff --git a/nnn.c b/nnn.c
index 8eda2b3..dc679fb 100644
--- a/nnn.c
+++ b/nnn.c
@@ -22,6 +22,17 @@
 #define LINUX_INOTIFY
 #endif
 #include <sys/resource.h>
+#ifdef __linux__
+#ifndef __USE_LARGEFILE64
+#define __USE_LARGEFILE64 1
+#endif
+#ifndef _LARGEFILE_SOURCE
+#define _LARGEFILE_SOURCE 1
+#endif
+#ifndef _LARGEFILE64_SOURCE
+#define _LARGEFILE64_SOURCE 1
+#endif
+#endif
 #include <sys/stat.h>
 #include <sys/statvfs.h>
 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Still no changes.

from nnn.

jarun avatar jarun commented on September 21, 2024

OK. I think it's better to run it on a VM and test. It will take some time.

BTW, is there any specific reason you are running a 32-bit OS? I am also considering explicitly removing support for 32-bit because most people use 64-bit nowadays.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

I'm too lazy to reinstall my OS, it works for many years and I don't have any problems with it (at least with PAE kernel).
At the same time, for some other computers 64-bit OS is not an option. I'm talking about some old fun-boxes that still can be used. I think nnn would be a great thing for those machines (nnn + tty = ♥).

from nnn.

jarun avatar jarun commented on September 21, 2024

Major distros like Arch and Fedora are phasing out 32-bit support. My problem is, I can't test and support newer changes on i386, both due to time and resource crunch. I'll probably add this fix and then call it a day for i386.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Major distros like Arch and Fedora are phasing out 32-bit support.

Well, they're have poor non-amd64 architectures support in general. Fortunately it's not an issue in Debian.

My problem is, I can't test and support newer changes on i386, both due to time and resource crunch. I'll probably add this fix and then call it a day for i386.

Thank you. That would be great. And I doubt there will be more problems with i386 support.

from nnn.

jarun avatar jarun commented on September 21, 2024

Can you try the following Makefile patch:

diff --git a/Makefile b/Makefile
index d281d0c..f83e8c9 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ VERSION = 1.4
 PREFIX ?= /usr/local
 MANPREFIX = $(PREFIX)/share/man
 
-CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter
+CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -D_FILE_OFFSET_BITS=64
 LDLIBS = -lreadline
 
 ifeq ($(shell pkg-config ncursesw && echo 1),1)

As per this thread it should do the trick.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

With or without previous nnn.c patch?

from nnn.

jarun avatar jarun commented on September 21, 2024

Without the previous patch.

from nnn.

jarun avatar jarun commented on September 21, 2024

And if the Makefile patch works, try this one (without the Makefile patch):

diff --git a/nnn.c b/nnn.c
index 8eda2b3..7a6c357 100644
--- a/nnn.c
+++ b/nnn.c
@@ -22,6 +22,9 @@
 #define LINUX_INOTIFY
 #endif
 #include <sys/resource.h>
+#ifdef __i386__
+#define FILE_OFFSET_BITS 64
+#endif
 #include <sys/stat.h>
 #include <sys/statvfs.h>
 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Makefile patch works, but nnn.c patch doesn't.

from nnn.

jarun avatar jarun commented on September 21, 2024

Which compiler are you using?

from nnn.

goberghen avatar goberghen commented on September 21, 2024

What do you mean?
Maybe I should change #ifdef __i386__ to #ifdef __i686__ in the last patch?

from nnn.

jarun avatar jarun commented on September 21, 2024

Sure! Try it out!

from nnn.

jarun avatar jarun commented on September 21, 2024

Otherwise, please move those 3 lines to the top. Just not sure if inotify.h includes stat.h internally.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

No, i686 doesn't work either.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Otherwise, please move those 3 lines to the top. Just not sure if inotify.h includes stat.h internally.

Ok.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Moving those lines doesn't helped.

from nnn.

jarun avatar jarun commented on September 21, 2024

Try this:

diff --git a/nnn.c b/nnn.c
index 8eda2b3..cfbbc54 100644
--- a/nnn.c
+++ b/nnn.c
@@ -22,6 +22,9 @@
 #define LINUX_INOTIFY
 #endif
 #include <sys/resource.h>
+#ifdef __i386__
+#define _FILE_OFFSET_BITS 64
+#endif
 #include <sys/stat.h>
 #include <sys/statvfs.h>
 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)

from nnn.

goberghen avatar goberghen commented on September 21, 2024

No result.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

I'll try with i686.

from nnn.

jarun avatar jarun commented on September 21, 2024

Also, please move it to the top and try.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Works now!

#ifdef __i686__
#define _FILE_OFFSET_BITS 64
#endif

on top before
#ifdef __linux__

from nnn.

jarun avatar jarun commented on September 21, 2024

OK

from nnn.

jarun avatar jarun commented on September 21, 2024

Wait a little.

from nnn.

jarun avatar jarun commented on September 21, 2024

Try the following:

diff --git a/nnn.c b/nnn.c
index 8eda2b3..fc893a2 100644
--- a/nnn.c
+++ b/nnn.c
@@ -18,6 +18,9 @@
  */
 
 #ifdef __linux__
+#ifdef __i686__
+#define _FILE_OFFSET_BITS 64
+#endif
 #include <sys/inotify.h>
 #define LINUX_INOTIFY
 #endif

I am trying to limit this as Linux-only till I get reports from other platforms.

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Works too.

from nnn.

jarun avatar jarun commented on September 21, 2024

Awesome!
I'll push the patch soon!

from nnn.

jarun avatar jarun commented on September 21, 2024

Thanks a lot for your help!

from nnn.

goberghen avatar goberghen commented on September 21, 2024

Thank you.
By the way, #ifdef __i386__ works too, so maybe it's better to prefer 386 over 686.

from nnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.