{"thread":{"id":"60606","subject":"Propose a change in open for passing in the file type.","startedAt":"2023-12-12T14:46:08Z","lastAt":"2023-12-16T13:28:51Z","messageCount":4,"participants":["Haritha D","Torsten Bögershausen","Đoàn Trần Công Danh"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"485578","messageId":"E1D54D98-3836-41CA-84B5-32AEAF7642D8@ibm.com","threadId":"60606","inReplyTo":null,"subject":"Propose a change in open for passing in the file type.","fromName":"Haritha D","fromEmail":"harithamma.d@ibm.com","sentAt":"2023-12-12T14:46:04Z","receivedAt":"2023-12-12T14:46:08Z","isPatch":false,"sender":{"key":"harithamma.d@ibm.com","avatar":"https://avatars.githubusercontent.com/u/112700353?v=4"},"body":"Hi Everyone,\n \nAm working on porting git to z/OS. For reference, the pull request am working on https://github.com/git/git/pull/1537.\n \nOn z/OS there is a notion of file tag attributes. Files can be tagged as binary, ASCII, UTF8, EBCDIC, etc. z/OS uses these attributes to determine if auto-conversion is necessary. It was recommended in PR that we add logic directly to xopen . In order for me to do this in xopen , I have to pass an extra parameter to xopen that specifies the file type. \n \nEx: \nxopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);\n \nTo :\nxopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666, BINARY);\n \nBINARY: would be an enum value.\n \nWould this be okay to do? Or are there other recommendations?\n \nBest regards\nHaritha\n\n\n"},{"id":"485586","messageId":"20231212172942.GA12692@tb-raspi4","threadId":"60606","inReplyTo":"E1D54D98-3836-41CA-84B5-32AEAF7642D8@ibm.com","subject":"Re: Propose a change in open for passing in the file type.","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2023-12-12T17:29:43Z","receivedAt":"2023-12-12T17:29:48Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Tue, Dec 12, 2023 at 02:46:04PM +0000, Haritha D wrote:\n> Hi Everyone,\n>\n> Am working on porting git to z/OS. For reference, the pull request am working on https://github.com/git/git/pull/1537.\n>\n> On z/OS there is a notion of file tag attributes. Files can be tagged as binary, ASCII, UTF8, EBCDIC, etc. z/OS uses these attributes to determine if auto-conversion is necessary. It was recommended in PR that we add logic directly to xopen . In order for me to do this in xopen , I have to pass an extra parameter to xopen that specifies the file type. \n>  \n> Ex:\n> xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);\n>\n> To :\n> xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666, BINARY);\n>\n> BINARY: would be an enum value.\n>\n> Would this be okay to do? Or are there other recommendations?\n\nI think that the suggestion was to embedd the BINARY thing into xopen(),\nnot to all callers of xopen().\n\nIf you have this type of special handling for one specific OS,\ncall it quirks, if you want, they are better placed in an own file.\n\nPlease see e.g. compat/mingw.c as an example, how things are solved\nfor Git for windows.\nThen there are some include files, which re-define things like open(),\nif needed.\n\nAnother example could be\ncompat/win32/dirent.c\n\nWhere exactly things are placed, is may be a matter of taste,\nthat may be decided later.\nIn your case a file like\ncompat/z_os.c and z_os.h may make clear what this is about to everybody.\n\n\n\n\n>\n> Best regards\n> Haritha\n>\n>\n"},{"id":"485603","messageId":"ZXkwTYD9nmPYn9UW@danh.dev","threadId":"60606","inReplyTo":"E1D54D98-3836-41CA-84B5-32AEAF7642D8@ibm.com","subject":"Re: Propose a change in open for passing in the file type.","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2023-12-13T04:17:17Z","receivedAt":"2023-12-13T04:17:20Z","isPatch":false,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"On 2023-12-12 14:46:04+0000, Haritha D <Harithamma.D@ibm.com> wrote:\n> Hi Everyone,\n>  \n> Am working on porting git to z/OS. For reference, the pull request am working on https://github.com/git/git/pull/1537.\n>  \n> On z/OS there is a notion of file tag attributes. Files can be\n> tagged as binary, ASCII, UTF8, EBCDIC, etc. z/OS uses these\n> attributes to determine if auto-conversion is necessary. It was\n> recommended in PR that we add logic directly to xopen . In order for\n> me to do this in xopen , I have to pass an extra parameter to xopen\n> that specifies the file type. \n>  \n> Ex: \n> xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);\n>  \n> To :\n> xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666, BINARY);\n>  \n> BINARY: would be an enum value.\n\nWould it work if you always open the file as BINARY? And let's all the\nconversion done by git via some configs (core.encoding?)?\n\n-- \nDanh\n"},{"id":"485747","messageId":"20231216132844.GA10935@tb-raspi4","threadId":"60606","inReplyTo":"ZXkwTYD9nmPYn9UW@danh.dev","subject":"Re: Propose a change in open for passing in the file type.","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2023-12-16T13:28:44Z","receivedAt":"2023-12-16T13:28:51Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Wed, Dec 13, 2023 at 11:17:17AM +0700, Đoàn Trần Công Danh wrote:\n[]\n> Would it work if you always open the file as BINARY?\nYes, I think so.\n\n> And let's all the\n> conversion done by git via some configs (core.encoding?)?\nWe already have an attribute, \"working-tree-encoding\", that\ncan tell Git to do the encoding/reencoding.\nThe advantage of the .gitattributes file is, that it is\ntypically commit into the repo, and travels with `git push`\nand `git fetch` or `git pull` to the different work stations,\nso that everybody has the same settings.\n\nIn opposite, config files are always local.\nSo that everybody should do the same (local) git config.\nIf that is forgotten for some reason, then different\nconfigurations leads often to some kind of chaos.\n\nBut I don't have a z/os sytem to test on.\n"}]}