Skip to content

Watchman crash on path = . #22

Closed
Closed

Description

@dturner-tw

$ mkdir /tmp/fileURkhtr
$ echo "foo" > /tmp/fileURkhtr/morx.jar
$ watchman watch /tmp/fileURkhtr
$ socat - /tmp/.watchman.dturner <<EOF
["query", "/tmp/fileURkhtr", {"expression": ["since", "c:1390499661:13064:15:3"], "fields": ["name", "ctime_f"], "path": ["."]}]
EOF
(socat exits here, because watchman has crashed)

Here's a backtrace from watchman:
$ gdb /home/dturner/watchman/watchman
(gdb) r -f
Starting program: /home/dturner/watchman/watchman -f
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff75bf700 (LWP 16489)]
[New Thread 0x7ffff657b700 (LWP 16490)]
[New Thread 0x7ffff5c79700 (LWP 16496)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff5c79700 (LWP 16496)]
w_ht_lookup (ht=0x0, key=140737085710048, val=0x7ffff5c78a28, copy=false)
at ht.c:396
396 };
(gdb) bt
#0 w_ht_lookup (ht=0x0, key=140737085710048, val=0x7ffff5c78a28, copy=false)

at ht.c:396

#1 0x0000000000406ddb in w_ht_get (ht=, key=)

at ht.c:217

#2 0x000000000040a3d1 in path_generator (ctx=,

root=<optimized out>, query=<optimized out>) at query/eval.c:252

#3 default_generators (query=0x7fffe8000ed0, root=0x7ffff697e010,

ctx=0x7ffff5c78ab0, gendata=<optimized out>) at query/eval.c:291

#4 0x000000000040a538 in w_query_execute (query=0x7fffe8000ed0,

root=0x7ffff697e010, res=0x7ffff5c78c50, 
generator=0x40a0f0 <default_generators>, gendata=0x0) at query/eval.c:364

#5 0x00000000004076f4 in cmd_query (client=0x624d60, args=)

at cmds/query.c:52

#6 0x000000000040cea0 in dispatch_command (client=0x624d60,

args=0x7fffe80008e0) at listener.c:509

#7 0x000000000040d00e in client_thread (ptr=0x624d60) at listener.c:566
#8 0x00007ffff7bc4e9a in start_thread (arg=0x7ffff5c79700)

at pthread_create.c:308

#9 0x00007ffff76b43fd in clone ()

at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

#10 0x0000000000000000 in ?? ()

Activity

  1. added a commit that references this issue on Jan 23, 2014
  2. wez commented on Jan 23, 2014

    @wez
    Contributor

    Thanks for reporting this; I've pushed a fix.

    FWIW, path='.' will never match anything in watchman; the root is referred to as the empty string internally, and the '.' and '..' nodes are never indexed or referenced.

    The path generator is intended to be used in cases where you have a large tree with a large volume of changes and want to phrase your query as "walk all the files in path: return all that were modified since X", rather than "for each changed file since X, return all that match a path".

    The generators specify the file walking strategy; the expression term is used to match results and add them to the result set.

    If you want to check for changes since a prior query, you are generally better off using the since generator; move the since term out of the expression and place it alongside the expression. Then make your expression use a name matching term instead.

    If you just want to match any files that changed, you only need to include the since generator in your query.

  3. dturner-tw commented on Jan 23, 2014

    @dturner-tw
    ContributorAuthor

    Wow, thanks for the fast and comprehensive response!

  4. wez commented on Jan 23, 2014

    @wez
    Contributor

    Thanks for including a backtrace; made it super quick to resolve :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions