Giter Site home page Giter Site logo

Comments (7)

sahlberg avatar sahlberg commented on July 24, 2024

Linux uses st_atim.tv_sec and st_atim.tv_nsec instead of st_atime
nowadays.

Try using those instead of st_atime

On Wed, Oct 5, 2016 at 12:33 AM, dhanumuli [email protected] wrote:

I've following code for reading NFS directory contents
#python

import libnfs
nfsh = libnfs.NFS('nfs:///folder1/')
d = libnfs.new_NFSDirHandle()
ret = libnfs.nfs_opendir(nfsh._nfs, '/', d)
if ret == -libnfs.errno.ENOENT:
raise IOError(libnfs.errno.ENOENT, 'No such file or directory');
d = libnfs.NFSDirHandle_value(d)
dirEntry = libnfs.nfs_readdir(nfsh._nfs, d)
print dirEntry.name
abc --> attribute printed correctly
print dirEntry.mtime
swig/python detected a memory leak of type 'struct timeval *', no
destructor found.

I tried to access the mtime through various ways but was unable to do so.
All other attributes except mtime, atime, ctime are printed correctly. For
the time attributes only I get the above mentioned error.

Can you please help in understanding what's wrong here?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#11, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAeNkP0lVjHX-WoCAp8b2-Bf_dyM6kTnks5qw1KsgaJpZM4KOf4Q
.

from libnfs-python.

dhanumuli avatar dhanumuli commented on July 24, 2024

I don't think the problem is with st_atime.

I modified libnfs.i code to return atime.tv_sec directly instead of struct timeval (changed datatype of atime in struct nfsdirent from struct timeval to uint64_t). Made the corresponding change in C libnfs library code also.

My modified code prints the tv_sec value correctly (through atime directly). It is only when struct timeval atime value is tried to access in python, I hit the " swig/python detected a memory leak of type 'struct timeval *', no destructor found." error and no value is printed. Trying to print atime.tv_sec, atime.seconds also fails. dir() on atime also does not give any useful field which can return tv_sec value.

from libnfs-python.

dhanumuli avatar dhanumuli commented on July 24, 2024

I tried with ubuntu 12.04 LTS and I am getting the same error as earlier. Your original documentation mentions that you have tested on ubuntu 10 but I am not sure whether it will work on ubuntu 10 as well.

From this link, I think the problem could be returning a struct instead of struct pointer (for atime, mtime, ctime). I could be wrong so can you please confirm?

Once problem is confirmed, I can work on the fix. I tried changing struct timeval for atime to struct timeval * atime but it is giving segmentation fault. Debugging it further.

from libnfs-python.

dhanumuli avatar dhanumuli commented on July 24, 2024

Referring to my last comment, when I included struct timedef definition in libnfs.i file, my code works absolutely fine (gives correct values of struct timeval atime, mtime and ctime).

However, the problem there is, tv_sec and tv_usec in struct timeval are defined as __time_t and __suseconds_t which are defined as __SLONGWORD_TYPE which is defined in sys/types.h as
#define __SLONGWORD_TYPE long int

To make the code work, i've defined struct timeval in libnfs.i as follows
struct timeval {
long int tv_sec;
long int tv_usec;
};
which cannot be acceptable due to porting and compatibility.

Any pointers to how this can be solved?

from libnfs-python.

sahlberg avatar sahlberg commented on July 24, 2024

On Tue, Oct 18, 2016 at 12:18 AM, dhanumuli [email protected]
wrote:

Referring to my last comment, when I included struct timedef definition in
libnfs.i file, my code works absolutely fine (gives correct values of
struct timeval atime, mtime and ctime).

However, the problem there is, tv_sec and tv_usec in struct timeval are
defined as __time_t and __suseconds_t which are defined as __SLONGWORD_TYPE
which is defined in sys/types.h as
#define __SLONGWORD_TYPE long int

To make the code work, i've defined struct timeval in libnfs.i as follows
struct timeval {
long int tv_sec;
long int tv_usec;
};
which cannot be acceptable due to porting and compatibility.

Maybe this is what needs to be done.
Please send me a pull request for this and I will merge and try to figure
ut what to do about other platforms.

Can you also try out the utils/nfs-ls.py tool and see how it works ?

Any pointers to how this can be solved?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAeNkOk3wT81Vq9vT80NpnQfPmq22_hmks5q1HLGgaJpZM4KOf4Q
.

from libnfs-python.

dhanumuli avatar dhanumuli commented on July 24, 2024

I've already submitted pull request for the same #12

from libnfs-python.

sahlberg avatar sahlberg commented on July 24, 2024

Merged

from libnfs-python.

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.