[OmniOS-discuss] LX Zone DTrace

Mini Trader miniflowtrader at gmail.com
Sat Jan 14 14:16:55 UTC 2017


Well the author at my request was able to remove the call to os.getcwd()
which allows the program to operate.


If anyone wants to tinker here is an example that will likely break on
someones system.  I don't know if this is an LX bug, libc bug, python bug
etc.

# read a directory, stat all files

import os
import sys
from stat import *

def chdir(d):
    global cwdlist

    if d != '.':
        os.chdir(d)
        if d == '..':
            cwdlist.pop()
        else:
            cwdlist.append(d)
        print repr('/'.join(cwdlist))
        # Comment the line below to allow things to run
        os.getcwd()

def walk(d):
    chdir(d)
    dirlist = os.listdir('.')
    dirlist.sort()
    for f in dirlist:
        try:
            s = os.lstat(f)
            if S_ISDIR(s.st_mode):
                walk(f)
        except OSError, err:
            print err
    chdir('..')

if len(sys.argv) != 2:
    print 'need 1 arg, directory to scan'

os.chdir(sys.argv[1])
cwd = os.getcwd()
cwdlist = cwd.split('/')

walk('.')




On Fri, Jan 13, 2017 at 4:06 PM, Mini Trader <miniflowtrader at gmail.com>
wrote:

> Here is the code.  It will run just fine with Debian 8.6 or OmniOS.  It
> will fail on the LX zone with Debian.  The only way for it to fail is for
> the stat call to fail and this seems to happen because the system doen't
> know what directory it is in.  The files being looked at are static so not
> a race condition.
>
> Simple python script.
>
> # read a directory, stat all files
>
> import os
> import sys
> from stat import *
>
> def walk(d):
>     os.chdir(d)
>     working = os.getcwd()
>     print working
>     dirlist = os.listdir('.')
>     dirlist.sort()
>     for f in dirlist:
>         try:
>             s = os.lstat(f)
>             if S_ISDIR(s.st_mode):
>                 walk(f)
>         except OSError, err:
>             print "CurrentDIR: " + working
>             print "CurrentFile: " + f
>             print err
>     os.chdir('..')
>     print "DONE"
>
> if len(sys.argv) != 2:
>     print 'need 1 arg, directory to scan'
>
> cwd = os.getcwd()
> os.chdir(sys.argv[1])
> walk('.')
>
>
> On Fri, Jan 13, 2017 at 3:52 PM, Dale Ghent <daleg at omniti.com> wrote:
>
>> Could you provide some of your telemetry and background here? There might
>> be a reasonable explanation, or a quick fix.
>>
>> /dale
>>
>> > On Jan 13, 2017, at 3:12 PM, Mini Trader <miniflowtrader at gmail.com>
>> wrote:
>> >
>> > I have a small program that will reproduce the issue.  Where should the
>> bug be sent?  It's pretty serious.  The system is forgetting the location
>> of the current working directory in a recursive call.
>> >
>> > On Fri, Jan 13, 2017 at 9:30 AM, Nahum Shalman <nshalman at omniti.com>
>> wrote:
>> > Have you tried simply tracing the lx-syscall probes?
>> >
>> > On Fri, Jan 13, 2017 at 9:24 AM, Mini Trader <miniflowtrader at gmail.com>
>> wrote:
>> > I followed these instructions prior to my post and my zone would not
>> boot after doing the mod to add the flag to the file.
>> >
>> >
>> > On Fri, Jan 13, 2017 at 8:55 AM Nahum Shalman <nshalman at omniti.com>
>> wrote:
>> > The short answer is yes.
>> >
>> > My experience debugging LX was on SmartOS and there are some notes on
>> https://wiki.smartos.org/display/DOC/LX+Branded+Zones#LXBran
>> dedZones-Debugging
>> >
>> > Some of the details on that page are Specific to SmartOS, but some of
>> it is generic to LX.
>> >
>> > -Nahum
>> >
>> > On Fri, Jan 13, 2017 at 12:46 AM, Mini Trader <miniflowtrader at gmail.com>
>> wrote:
>> > Is there anything that can be done to trace a program having issues on
>> an LX Zone.
>> >
>> > I am seeing:
>> >
>> > OSError: [Errno 2] No such file or directory:
>> >
>> > Again under certain conditions which I am trying to trace -
>> unfortunately this is a closed source program.  Can DTrace be used to help
>> track something like this?
>> >
>> > Thanks!
>> >
>> >
>> >
>> > _______________________________________________
>> >
>> >
>> > OmniOS-discuss mailing list
>> >
>> >
>> > OmniOS-discuss at lists.omniti.com
>> >
>> >
>> > http://lists.omniti.com/mailman/listinfo/omnios-discuss
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > OmniOS-discuss mailing list
>> > OmniOS-discuss at lists.omniti.com
>> > http://lists.omniti.com/mailman/listinfo/omnios-discuss
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://omniosce.org/ml-archive/attachments/20170114/9f4aefda/attachment-0001.html>


More information about the OmniOS-discuss mailing list