open-automation / switch-job-repeater

Dynamically replicate incoming jobs.
MIT License
0 stars 0 forks source link

incorrect permissions applied and files become inaccesible #2

Open ArturLorek opened 6 years ago

ArturLorek commented 6 years ago

Hello; I am having an issue where occasionally JobRepeater when creating the copies / multiple instances of the initial file, applies incorrect permissions to the folders / files in them, making them inaccesible to MergeTool for further processing / merging into one file. Merge Fails, as the Incoming Job is not present, as it cannot grant access to the files it is to merge. Can share a video which was recorded by Enfocus Support when troubleshooting the issue (https://esko.box.com/s/huzvedyz99e18wpl2s7ogwkkfoawr9uw). The files that were produced with JobRepeater cannot even be deleted from Explorer, due to permissions issue. Documents before JobRepeater are fine. Please advise.

KR Arthur

Dominick-Peluso-Bose commented 6 years ago

Hi Arthur,

Thanks for the video. It made it very easy to understand the problem. Your flow design looks great -- very easy to read.

This does seem like job repeater is somehow creating folders with incorrect permissions. If I was a betting man, I would say it was due to this logic that Freddy added to assemble repeated files in a folder. It seems he uses the create method to get a new folder's path (createPathWithName) but then uses that to copy files to a sub-directory in that path. That sub-directory may not have the correct permissions. https://github.com/open-automation/switch-job-repeater/blob/master/src/switch-job-repeater.js#L52-L59

@freddy-pieters does this assessment look correct to you?

@ArturLorek, in the mean time, could you try to disable the "Assemble in job folder" function? (then you'd have to assemble them yourself with another configurator). I'm thinking that would allow you to bypass this bug for now.

freddy-pieters commented 6 years ago

Hi Dominick,

The directory that is created with s.createPathWithName has write permissions; Switch takes care of that. So copying the files into that directory should work. True, this is not being tested and is perhaps something that should be added.

Back to square one: what is the exact problem? I have not seen the video so I can only speculate.

Regards,

Freddy Pieters Product Support Manager Enfocus, an Esko company

Tel. +32 (0)9 216 93 97 - Fax +32 (0)9 216 92 12 – Mob. +32 473 92 20 41 Kortrijksesteenweg 1095 – 9051 Gent - Belgium freddyp@enfocus.commailto:freddyp@enfocus.com - www.enfocus.com

Follow us on: http://twitter.com/enfocussw http://www.facebook.com/EnfocusSW http://linkd.in/f1H4Q8

The information contained in this e-mail (including any attachments) is privileged and confidential. It is intended only for the use of the individual(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.

From: Dominick Peluso notifications@github.com<mailto:notifications@github.com> Reply-To: open-automation/switch-job-repeater reply@reply.github.com<mailto:reply@reply.github.com> Date: Monday, April 23, 2018 at 15:52 To: open-automation/switch-job-repeater switch-job-repeater@noreply.github.com<mailto:switch-job-repeater@noreply.github.com> Cc: "Pieters, Freddy" freddyp@enfocus.com<mailto:freddyp@enfocus.com>, Mention mention@noreply.github.com<mailto:mention@noreply.github.com> Subject: Re: [open-automation/switch-job-repeater] incorrect permissions applied and files become inaccesible (#2)

Hi Arthur,

Thanks for the video. It made it very easy to understand the problem. Your flow design looks great -- very easy to read.

This does seem like job repeater is somehow creating folders with incorrect permissions. If I was a betting man, I would say it was due to this logic that Freddy added to assemble repeated files in a folder. It seems he uses the create method to get a new folder's path (createPathWithName) but then uses that to copy files to a sub-directory in that path. That sub-directory may not have the correct permissions. https://github.com/open-automation/switch-job-repeater/blob/master/src/switch-job-repeater.js#L52-L59https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_open-2Dautomation_switch-2Djob-2Drepeater_blob_master_src_switch-2Djob-2Drepeater.js-23L52-2DL59&d=DwMFaQ&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=ILzfaz58i81ZLj5nM4N_5akx7JjDw9BXcm0S1hAVUG4&m=pJpNC_-1M0ORLGJSXgRJAJadi1kZUjW_fSTniF0P-NE&s=4HxFyzXOVzeNz-jDnrugXxfS7lb-kRW23jV2aMiJKtY&e=

@freddy-pietershttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_freddy-2Dpieters&d=DwMFaQ&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=ILzfaz58i81ZLj5nM4N_5akx7JjDw9BXcm0S1hAVUG4&m=pJpNC_-1M0ORLGJSXgRJAJadi1kZUjW_fSTniF0P-NE&s=jWmErcQQfIJS1-vh37-GMw-obToSjIxei1r_eP4Uc-4&e= does this assessment look correct to you?

@ArturLorekhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ArturLorek&d=DwMFaQ&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=ILzfaz58i81ZLj5nM4N_5akx7JjDw9BXcm0S1hAVUG4&m=pJpNC_-1M0ORLGJSXgRJAJadi1kZUjW_fSTniF0P-NE&s=WFTTFXnQUpyeuWnbhM-0b8NwkRsoiWmEF_U7actnMd0&e=, in the mean time, could you try to disable the "Assemble in job folder" function? (then you'd have to assemble them yourself with another configurator). I'm thinking that would allow you to bypass this bug for now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_open-2Dautomation_switch-2Djob-2Drepeater_issues_2-23issuecomment-2D383583025&d=DwMFaQ&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=ILzfaz58i81ZLj5nM4N_5akx7JjDw9BXcm0S1hAVUG4&m=pJpNC_-1M0ORLGJSXgRJAJadi1kZUjW_fSTniF0P-NE&s=OdXChq_r6HKBbkaNxvbvG7bOHAMYupt69l_7cxzSPo0&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AWKHLMOPVqBLx3mW0jvDyIQ0uJ8VviNbks5trdy4gaJpZM4TfBoy&d=DwMFaQ&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=ILzfaz58i81ZLj5nM4N_5akx7JjDw9BXcm0S1hAVUG4&m=pJpNC_-1M0ORLGJSXgRJAJadi1kZUjW_fSTniF0P-NE&s=VemfQLj_MKtGdn51y4rhcPIGIHZ5uOUAWXzy09RSCWM&e=.

Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment.

Dominick-Peluso-Bose commented 6 years ago

Hi Freddy,

It appears that the folders and the contents created by Inject-Lite (on Arthur's system) are created with incorrect permissions (or sometimes created with incorrect permissions). Another thought is maybe s.copy is copying some bad permissions that these files have -- which seems possible. Arthur is trying to move or copy the files out of the backing folder and each time it doesn't allow it within the OS. Inspecting the folder's security settings shows that Arthur doesn't have the proper permissions to edit.

ArturLorek commented 6 years ago

Guys, I think I got it sorted. I mean I found out what was the cause of it, have not found a solution yet. The thing is that the file that it all was failing on had a white space before the extension. Not so much of a problem when this is a file, as it ends with an extension. But when a folder is created, only the Job.NameProper is used, and thus the folder name ended with a white space. This is not OK for the system to assign correct permissions to the folder apparently. In Windows OS it is not even possible (when you hand create a folder) to name it with a white space at the end, as Windows would ignore the white space and shorten it to the last character. When Switch creates the folders - it seems to be somehow possible and so it creates issues. Would it make sense ?? Can this issue be addressed?

-- EDIT -- A workaround this would be to go with Renaming tool for the JobName - search RegEx <\s+(.[^.]+)$> and replace with <\1> so that it removed all the white spaces before the extension. But I believe since the OS does not allow for this kind of thing to be successfully created (ditching the white space at the end of the folder name), so should the software which is working within that OS. Am I right ??

freddy-pieters commented 6 years ago

Hi Arthur,

Yes, I have run into that problem before in a completely different context. It can be easily fixed: Line 52: var assembleFolder = s.createPathWithName(job.getNameProper(),true); becomes:

var assembleFolder = s.createPathWithName(job.getNameProper().replace(/\s$/,””),true);

If you are using the script you can already get going. I will make a new version of the app some time later this week.

Regards,

Freddy Pieters Product Support Manager Enfocus, an Esko company

Tel. +32 (0)9 216 93 97 - Fax +32 (0)9 216 92 12 – Mob. +32 473 92 20 41 Kortrijksesteenweg 1095 – 9051 Gent - Belgium freddyp@enfocus.commailto:freddyp@enfocus.com - www.enfocus.com

Follow us on: http://twitter.com/enfocussw http://www.facebook.com/EnfocusSW http://linkd.in/f1H4Q8

The information contained in this e-mail (including any attachments) is privileged and confidential. It is intended only for the use of the individual(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.

From: Artur Lorek notifications@github.com<mailto:notifications@github.com> Reply-To: open-automation/switch-job-repeater reply@reply.github.com<mailto:reply@reply.github.com> Date: Tuesday, April 24, 2018 at 10:44 To: open-automation/switch-job-repeater switch-job-repeater@noreply.github.com<mailto:switch-job-repeater@noreply.github.com> Cc: "Pieters, Freddy" freddyp@enfocus.com<mailto:freddyp@enfocus.com>, Mention mention@noreply.github.com<mailto:mention@noreply.github.com> Subject: Re: [open-automation/switch-job-repeater] incorrect permissions applied and files become inaccesible (#2)

Guys, I think this is sorted. I mean I found out what was the cause of it, have not found a solution yet. The thing is that the file that it all was failing on had a white space before the extension. Not so much of a problem when this is a file, as it ends with an extension. But when a folder is created, only the Job.NameProper is used, and thus the folder name ended with a white space. This is not OK for the system to assign correct permissions to the folder apparently. In Windows OS it is not even possible (when you hand create a folder) to name it with a white space at the end, as Windows would ignore the white space and shorten it to the last character. When Switch creates the folders - it seems to be somehow possible and so it creates issues. Would it make sense ?? Can this issue be addressed?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_open-2Dautomation_switch-2Djob-2Drepeater_issues_2-23issuecomment-2D383853011&d=DwMFaQ&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=ILzfaz58i81ZLj5nM4N_5akx7JjDw9BXcm0S1hAVUG4&m=nsHkfhJ4rXW2p4rLssx1f262T1aHMOk5lXqU_VL8e5I&s=ZqPY4B71zukbNXSDilOfXAkgbkDOOEhXoZKXFp4Vpjw&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AWKHLNpWSzV6-2DFSo5JwvQEaKZRSRBwNkks5truXtgaJpZM4TfBoy&d=DwMFaQ&c=9mghv0deYPYDGP-W745IEdQLV1kHpn4XJRvR6xMRXtA&r=ILzfaz58i81ZLj5nM4N_5akx7JjDw9BXcm0S1hAVUG4&m=nsHkfhJ4rXW2p4rLssx1f262T1aHMOk5lXqU_VL8e5I&s=kFp7f9DroYvOz5LcVR1upK9HdHY5kcR-3h6uBEcbBnM&e=.

Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment.

freddy-pieters commented 6 years ago

Let me fine-tune this: var assembleFolder = s.createPathWithName(job.getNameProper().replace(/\s+$/,””),true);

so it takes one or more spaces at the end.

@dominick: may I ask you to update the code on github?