{"action":"created","comment":{"url":"https://api.github.com/repos/SIPp/sipp/pulls/comments/31388371","id":31388371,"diff_hunk":"@@ -93,11 +94,37 @@ float2timer (float time, struct timeval *tvp)\n     tvp->tv_usec = n * 100000;\n }\n \n-/* buffer should be \"file_name\" */\n-int\n-parse_play_args (char *buffer, pcap_pkts *pkts)\n+static char* find_file(const char* filename)\n {\n-    pkts->file = strdup (buffer);\n+    if (filename[0] == '/' || !scenario_path) {\n+        return strdup(filename);\n+    }\n+\n+    char* fullpath = NULL;\n+    if (asprintf(&fullpath, \"%s/%s\", scenario_path, filename) < 0) {\n+        ERROR_NO(\"Failed to allocate filepath\");\n+    }\n+\n+    if (access(fullpath, R_OK) < 0) {\n+        free(fullpath);\n+        WARNING(\"SIPp now prefers looking for pcap files next to the scenario. \"\n+                \"{} couldn't be found next to the secnario, falling back to \"","path":"src/send_packets.c","position":30,"original_position":30,"commit_id":"12cda2a381e8252f30073861b9b1a8142e28f8f9","original_commit_id":"12cda2a381e8252f30073861b9b1a8142e28f8f9","user":{"login":"wdoekes","id":1225014,"avatar_url":"https://avatars.githubusercontent.com/u/1225014?v=3","gravatar_id":"","url":"https://api.github.com/users/wdoekes","html_url":"https://github.com/wdoekes","followers_url":"https://api.github.com/users/wdoekes/followers","following_url":"https://api.github.com/users/wdoekes/following{/other_user}","gists_url":"https://api.github.com/users/wdoekes/gists{/gist_id}","starred_url":"https://api.github.com/users/wdoekes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wdoekes/subscriptions","organizations_url":"https://api.github.com/users/wdoekes/orgs","repos_url":"https://api.github.com/users/wdoekes/repos","events_url":"https://api.github.com/users/wdoekes/events{/privacy}","received_events_url":"https://api.github.com/users/wdoekes/received_events","type":"User","site_admin":false},"body":"Since when does vprintf take python-format-style `{}` parameters? (Shouldn't this have thrown a `-Wformat-extra-args` error?)\r\n\r\nAnd \"secnario\".","created_at":"2015-05-31T08:59:44Z","updated_at":"2015-05-31T08:59:44Z","html_url":"https://github.com/SIPp/sipp/pull/145#discussion_r31388371","pull_request_url":"https://api.github.com/repos/SIPp/sipp/pulls/145","_links":{"self":{"href":"https://api.github.com/repos/SIPp/sipp/pulls/comments/31388371"},"html":{"href":"https://github.com/SIPp/sipp/pull/145#discussion_r31388371"},"pull_request":{"href":"https://api.github.com/repos/SIPp/sipp/pulls/145"}}},"pull_request":{"url":"https://api.github.com/repos/SIPp/sipp/pulls/145","id":36575977,"html_url":"https://github.com/SIPp/sipp/pull/145","diff_url":"https://github.com/SIPp/sipp/pull/145.diff","patch_url":"https://github.com/SIPp/sipp/pull/145.patch","issue_url":"https://api.github.com/repos/SIPp/sipp/issues/145","number":145,"state":"open","locked":false,"title":"Change pcap search logic so we prefer files found next to the scenario file.","user":{"login":"vodik","id":216803,"avatar_url":"https://avatars.githubusercontent.com/u/216803?v=3","gravatar_id":"","url":"https://api.github.com/users/vodik","html_url":"https://github.com/vodik","followers_url":"https://api.github.com/users/vodik/followers","following_url":"https://api.github.com/users/vodik/following{/other_user}","gists_url":"https://api.github.com/users/vodik/gists{/gist_id}","starred_url":"https://api.github.com/users/vodik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vodik/subscriptions","organizations_url":"https://api.github.com/users/vodik/orgs","repos_url":"https://api.github.com/users/vodik/repos","events_url":"https://api.github.com/users/vodik/events{/privacy}","received_events_url":"https://api.github.com/users/vodik/received_events","type":"User","site_admin":false},"body":"One of the breaking changes with the Sangoma SIPp fork is that we changed the pcap search logic to prefer looking next to the scenario file. This made organizing a large collection of different sipp scenarios considerably simpler.\r\n\r\nThis is a more thorough patch to the one we have internally, refactoring some other logic as well. I was going to initially prefer checking the current working directory and then, failing finding a pcap there, search next to the scenario. While discussing this change with @wdoekes, he suggested that the current behaviour could actually be considered a bug, which prompted to instead do the reverse, prefer the file next to the scenario instead. This probably makes way more sense and what would be expected anyways.\r\n\r\nSo, assuming we go with this approach, this patch also adds some additional warning messages to help with the migration:\r\n\r\n- Warn if the pcap can't be found next to the scenario that we'll fallback to assuming the file is in the current working directory\r\n- Warn if the pcap happens to be found in both places that now the one next to the scenario will be used.\r\n\r\nCatch: the second warning can have false positives: when we provide a full path to the scenario which also happens to be in the current working directory as well. Either I should check if `scenario_path == getcwd()` or just drop the second warning. I'm not convinced its a common enough occurrence.","created_at":"2015-05-31T03:01:32Z","updated_at":"2015-05-31T08:59:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08df1e537ca5cc3a82366307f1f1c8634be33b1e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SIPp/sipp/pulls/145/commits","review_comments_url":"https://api.github.com/repos/SIPp/sipp/pulls/145/comments","review_comment_url":"https://api.github.com/repos/SIPp/sipp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SIPp/sipp/issues/145/comments","statuses_url":"https://api.github.com/repos/SIPp/sipp/statuses/12cda2a381e8252f30073861b9b1a8142e28f8f9","head":{"label":"vodik:search-path","ref":"search-path","sha":"12cda2a381e8252f30073861b9b1a8142e28f8f9","user":{"login":"vodik","id":216803,"avatar_url":"https://avatars.githubusercontent.com/u/216803?v=3","gravatar_id":"","url":"https://api.github.com/users/vodik","html_url":"https://github.com/vodik","followers_url":"https://api.github.com/users/vodik/followers","following_url":"https://api.github.com/users/vodik/following{/other_user}","gists_url":"https://api.github.com/users/vodik/gists{/gist_id}","starred_url":"https://api.github.com/users/vodik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vodik/subscriptions","organizations_url":"https://api.github.com/users/vodik/orgs","repos_url":"https://api.github.com/users/vodik/repos","events_url":"https://api.github.com/users/vodik/events{/privacy}","received_events_url":"https://api.github.com/users/vodik/received_events","type":"User","site_admin":false},"repo":{"id":24949678,"name":"sipp","full_name":"vodik/sipp","owner":{"login":"vodik","id":216803,"avatar_url":"https://avatars.githubusercontent.com/u/216803?v=3","gravatar_id":"","url":"https://api.github.com/users/vodik","html_url":"https://github.com/vodik","followers_url":"https://api.github.com/users/vodik/followers","following_url":"https://api.github.com/users/vodik/following{/other_user}","gists_url":"https://api.github.com/users/vodik/gists{/gist_id}","starred_url":"https://api.github.com/users/vodik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vodik/subscriptions","organizations_url":"https://api.github.com/users/vodik/orgs","repos_url":"https://api.github.com/users/vodik/repos","events_url":"https://api.github.com/users/vodik/events{/privacy}","received_events_url":"https://api.github.com/users/vodik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vodik/sipp","description":"The SIPp testing tool","fork":true,"url":"https://api.github.com/repos/vodik/sipp","forks_url":"https://api.github.com/repos/vodik/sipp/forks","keys_url":"https://api.github.com/repos/vodik/sipp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vodik/sipp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vodik/sipp/teams","hooks_url":"https://api.github.com/repos/vodik/sipp/hooks","issue_events_url":"https://api.github.com/repos/vodik/sipp/issues/events{/number}","events_url":"https://api.github.com/repos/vodik/sipp/events","assignees_url":"https://api.github.com/repos/vodik/sipp/assignees{/user}","branches_url":"https://api.github.com/repos/vodik/sipp/branches{/branch}","tags_url":"https://api.github.com/repos/vodik/sipp/tags","blobs_url":"https://api.github.com/repos/vodik/sipp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vodik/sipp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vodik/sipp/git/refs{/sha}","trees_url":"https://api.github.com/repos/vodik/sipp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vodik/sipp/statuses/{sha}","languages_url":"https://api.github.com/repos/vodik/sipp/languages","stargazers_url":"https://api.github.com/repos/vodik/sipp/stargazers","contributors_url":"https://api.github.com/repos/vodik/sipp/contributors","subscribers_url":"https://api.github.com/repos/vodik/sipp/subscribers","subscription_url":"https://api.github.com/repos/vodik/sipp/subscription","commits_url":"https://api.github.com/repos/vodik/sipp/commits{/sha}","git_commits_url":"https://api.github.com/repos/vodik/sipp/git/commits{/sha}","comments_url":"https://api.github.com/repos/vodik/sipp/comments{/number}","issue_comment_url":"https://api.github.com/repos/vodik/sipp/issues/comments{/number}","contents_url":"https://api.github.com/repos/vodik/sipp/contents/{+path}","compare_url":"https://api.github.com/repos/vodik/sipp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vodik/sipp/merges","archive_url":"https://api.github.com/repos/vodik/sipp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vodik/sipp/downloads","issues_url":"https://api.github.com/repos/vodik/sipp/issues{/number}","pulls_url":"https://api.github.com/repos/vodik/sipp/pulls{/number}","milestones_url":"https://api.github.com/repos/vodik/sipp/milestones{/number}","notifications_url":"https://api.github.com/repos/vodik/sipp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vodik/sipp/labels{/name}","releases_url":"https://api.github.com/repos/vodik/sipp/releases{/id}","created_at":"2014-10-08T16:27:42Z","updated_at":"2015-05-06T21:26:45Z","pushed_at":"2015-05-31T03:43:24Z","git_url":"git://github.com/vodik/sipp.git","ssh_url":"git@github.com:vodik/sipp.git","clone_url":"https://github.com/vodik/sipp.git","svn_url":"https://github.com/vodik/sipp","homepage":"http://sipp.sf.net","size":4115,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"SIPp:master","ref":"master","sha":"be9ad4b09a1a9fde47542251901fcf6238f77387","user":{"login":"SIPp","id":5304973,"avatar_url":"https://avatars.githubusercontent.com/u/5304973?v=3","gravatar_id":"","url":"https://api.github.com/users/SIPp","html_url":"https://github.com/SIPp","followers_url":"https://api.github.com/users/SIPp/followers","following_url":"https://api.github.com/users/SIPp/following{/other_user}","gists_url":"https://api.github.com/users/SIPp/gists{/gist_id}","starred_url":"https://api.github.com/users/SIPp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SIPp/subscriptions","organizations_url":"https://api.github.com/users/SIPp/orgs","repos_url":"https://api.github.com/users/SIPp/repos","events_url":"https://api.github.com/users/SIPp/events{/privacy}","received_events_url":"https://api.github.com/users/SIPp/received_events","type":"Organization","site_admin":false},"repo":{"id":13161657,"name":"sipp","full_name":"SIPp/sipp","owner":{"login":"SIPp","id":5304973,"avatar_url":"https://avatars.githubusercontent.com/u/5304973?v=3","gravatar_id":"","url":"https://api.github.com/users/SIPp","html_url":"https://github.com/SIPp","followers_url":"https://api.github.com/users/SIPp/followers","following_url":"https://api.github.com/users/SIPp/following{/other_user}","gists_url":"https://api.github.com/users/SIPp/gists{/gist_id}","starred_url":"https://api.github.com/users/SIPp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SIPp/subscriptions","organizations_url":"https://api.github.com/users/SIPp/orgs","repos_url":"https://api.github.com/users/SIPp/repos","events_url":"https://api.github.com/users/SIPp/events{/privacy}","received_events_url":"https://api.github.com/users/SIPp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SIPp/sipp","description":"The SIPp testing tool","fork":false,"url":"https://api.github.com/repos/SIPp/sipp","forks_url":"https://api.github.com/repos/SIPp/sipp/forks","keys_url":"https://api.github.com/repos/SIPp/sipp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SIPp/sipp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SIPp/sipp/teams","hooks_url":"https://api.github.com/repos/SIPp/sipp/hooks","issue_events_url":"https://api.github.com/repos/SIPp/sipp/issues/events{/number}","events_url":"https://api.github.com/repos/SIPp/sipp/events","assignees_url":"https://api.github.com/repos/SIPp/sipp/assignees{/user}","branches_url":"https://api.github.com/repos/SIPp/sipp/branches{/branch}","tags_url":"https://api.github.com/repos/SIPp/sipp/tags","blobs_url":"https://api.github.com/repos/SIPp/sipp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SIPp/sipp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SIPp/sipp/git/refs{/sha}","trees_url":"https://api.github.com/repos/SIPp/sipp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SIPp/sipp/statuses/{sha}","languages_url":"https://api.github.com/repos/SIPp/sipp/languages","stargazers_url":"https://api.github.com/repos/SIPp/sipp/stargazers","contributors_url":"https://api.github.com/repos/SIPp/sipp/contributors","subscribers_url":"https://api.github.com/repos/SIPp/sipp/subscribers","subscription_url":"https://api.github.com/repos/SIPp/sipp/subscription","commits_url":"https://api.github.com/repos/SIPp/sipp/commits{/sha}","git_commits_url":"https://api.github.com/repos/SIPp/sipp/git/commits{/sha}","comments_url":"https://api.github.com/repos/SIPp/sipp/comments{/number}","issue_comment_url":"https://api.github.com/repos/SIPp/sipp/issues/comments{/number}","contents_url":"https://api.github.com/repos/SIPp/sipp/contents/{+path}","compare_url":"https://api.github.com/repos/SIPp/sipp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SIPp/sipp/merges","archive_url":"https://api.github.com/repos/SIPp/sipp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SIPp/sipp/downloads","issues_url":"https://api.github.com/repos/SIPp/sipp/issues{/number}","pulls_url":"https://api.github.com/repos/SIPp/sipp/pulls{/number}","milestones_url":"https://api.github.com/repos/SIPp/sipp/milestones{/number}","notifications_url":"https://api.github.com/repos/SIPp/sipp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SIPp/sipp/labels{/name}","releases_url":"https://api.github.com/repos/SIPp/sipp/releases{/id}","created_at":"2013-09-27T21:28:32Z","updated_at":"2015-05-28T23:00:46Z","pushed_at":"2015-05-31T03:53:15Z","git_url":"git://github.com/SIPp/sipp.git","ssh_url":"git@github.com:SIPp/sipp.git","clone_url":"https://github.com/SIPp/sipp.git","svn_url":"https://github.com/SIPp/sipp","homepage":"http://sipp.sf.net","size":5304,"stargazers_count":95,"watchers_count":95,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":46,"mirror_url":null,"open_issues_count":58,"forks":46,"open_issues":58,"watchers":95,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SIPp/sipp/pulls/145"},"html":{"href":"https://github.com/SIPp/sipp/pull/145"},"issue":{"href":"https://api.github.com/repos/SIPp/sipp/issues/145"},"comments":{"href":"https://api.github.com/repos/SIPp/sipp/issues/145/comments"},"review_comments":{"href":"https://api.github.com/repos/SIPp/sipp/pulls/145/comments"},"review_comment":{"href":"https://api.github.com/repos/SIPp/sipp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SIPp/sipp/pulls/145/commits"},"statuses":{"href":"https://api.github.com/repos/SIPp/sipp/statuses/12cda2a381e8252f30073861b9b1a8142e28f8f9"}}}}