{ "id": "161205", "key": "TIMOB-23543", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-07-20T13:47:21.000+0000", "created": "2016-06-20T16:09:41.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "breaking-change", "parity" ], "versions": [], "issuelinks": [ { "id": "52081", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "161062", "key": "TIMOB-23512", "fields": { "summary": "Windows: relative require() from sub-directory fails", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "52049", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "124137", "key": "TIMOB-16078", "fields": { "summary": "Implement full NodeJS require specs so we can use NPM for modules", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2017-03-31T22:15:31.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" }, { "id": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "Our require implementation uses different values for __filename than what may be expected from an implementation like NodeJS. Additionally, our values differ between platforms.\r\n\r\nOn Windows, we get the base name of the file ('filename'). On iOS and Android we get the filename with no path info ('filename.js').\r\n\r\nTo match Node, we should be giving the absolute path to the resolved file ('/path/to/filename.js').", "attachment": [], "flagged": false, "summary": "TiAPI: require implementation uses incorrect __filename values", "creator": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "environment": null, "closedSprints": [ { "id": 682, "state": "closed", "name": "2016 Sprint 15 SDK", "startDate": "2016-07-16T00:19:20.819Z", "endDate": "2016-07-30T00:19:00.000Z", "completeDate": "2016-08-01T04:40:11.421Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "389091", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Windows: https://github.com/appcelerator/titanium_mobile_windows/pull/750", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-06-27T02:55:00.000+0000", "updated": "2016-06-27T02:55:00.000+0000" }, { "id": "389259", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Let me clear on the {{__filename}} spec for Windows: \r\nDoes that need to be \"Windows full path\" or \"path from application directory\"? What I mean here is:\r\n\r\nLet say we have\r\n\r\n{code}\r\napp.js\r\n - hello/\r\n - index.js\r\n{code}\r\n\r\n* Windows full path = {{C:\\Data\\SharedData\\PhoneTools\\AppxLayouts\\xxx\\hello\\index.js}}\r\n* Path for the application directory = {{/hello/index.js}}\r\n\r\n[My current PR|https://github.com/appcelerator/titanium_mobile_windows/pull/750] implements __filename from path for the application directory.", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-06-28T14:37:12.000+0000", "updated": "2016-06-28T14:37:12.000+0000" }, { "id": "389277", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "[~kota] Your implementation is correct. The __filename path is supposed to be the resolved absolute path, but I think on mobile OSes like we deal with, we effectively want it as \"absolute\" from the app root, not the underlying OS path with scheme. To the user the app root is typically their Resources folder (in terms of how they refer to files), we really want the resolved path from that as root.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-06-28T16:29:58.000+0000", "updated": "2016-06-28T16:29:58.000+0000" }, { "id": "389278", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "This is resolved fro Windows, but still need fixes from Android and iOS for parity.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-06-28T16:31:19.000+0000", "updated": "2016-06-28T16:31:19.000+0000" }, { "id": "389693", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "iOS PR: https://github.com/appcelerator/titanium_mobile/pull/8098\r\n\r\nMy test-case:\r\n{code:javascript}\r\napp.js\r\n - tmp/\r\n - sub/\r\n - index.js\r\n{code}\r\nOld {{__filename}}: {{index.js}} <-- Only filename\r\nNew {{__filename}}: {{/tmp/sub/index.js}} <-- Concatenation of the relative path from {{Resources}} plus the filename\r\n", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-07-01T00:23:28.000+0000", "updated": "2016-07-01T00:23:28.000+0000" }, { "id": "389737", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Hans' PR fixed the behavior for iOS. Just Android left.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-07-01T13:38:14.000+0000", "updated": "2016-07-01T13:38:14.000+0000" }, { "id": "389893", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Is there any hint or location that I should be looking at for this in Android? I'm looking and found this portion https://github.com/appcelerator/titanium_mobile/blob/415bd6c66dcc55b1a59a59574f3babd3c3a84ede/android/runtime/common/src/js/kroll.js#L119-L121\r\nI'm trying to see what's needed to be done to get this to work in Android.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-07-04T08:39:50.000+0000", "updated": "2016-07-04T08:39:50.000+0000" }, { "id": "389968", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "[~msamah] That is one possible location, but I think the fix is likely inside https://github.com/appcelerator/titanium_mobile/blob/415bd6c66dcc55b1a59a59574f3babd3c3a84ede/android/runtime/common/src/js/module.js\r\n\r\nI haven't looked close enough to see where we need to change the value for filename (in _runScript()? in load()?). It'd be good to test what we do report for Android locally to see what exactly needs to change (maybe it just needs a leading slash?). It appeared to only report the last path segment to me, but maybe it was reporting the full path on Android, just missing the leading slash?", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-07-06T14:21:38.000+0000", "updated": "2016-07-06T14:21:38.000+0000" }, { "id": "390914", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Working on Android version...", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-07-18T15:51:28.000+0000", "updated": "2016-07-18T15:51:28.000+0000" }, { "id": "390926", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/titanium_mobile/pull/8141", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-07-18T18:17:41.000+0000", "updated": "2016-07-18T18:17:41.000+0000" }, { "id": "392392", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Testing steps is mentioned in the PR using the test scripts. \r\nRefer to https://github.com/appcelerator/titanium_mobile/pull/8141", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-08-04T06:34:38.000+0000", "updated": "2016-08-04T06:34:38.000+0000" }, { "id": "416572", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed, if there are any problems, please file a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-31T22:15:31.000+0000", "updated": "2017-03-31T22:15:31.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }