Skip to content

bpo-37129: Add os.RWF_APPEND flag for os.pwritev #13735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

bpo-37129: Add os.RWF_APPEND flag for os.pwritev #13735

wants to merge 7 commits into from

Conversation

bezoka
Copy link

@bezoka bezoka commented Jun 1, 2019

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!


Append data to the end of the file.

.. availability:: Linux 4.7 and newer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be "Linux 4.16 and newer."

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -1230,6 +1231,15 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
.. versionadded:: 3.7


.. data:: RWF_APPEND

Append data to the end of the file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Append data to the end of the file. See the description of the flag of the same name in os.pwritev() as well as the description of O_APPEND in os.open(). The offset field is ignored. The file offset is not changed.

@@ -1230,6 +1231,16 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
.. versionadded:: 3.7


.. data:: RWF_APPEND

Append data to the end of the file. See the description of the flag 'O_APPEND' in ''os.open()''.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry "Provide a per-write equivalent of the O_APPEND in os.open(). This flag effect applies only to the data range written by the system call. The offset argument does not affect the write operation; the data is always appended to the end of the file. However, if the offset argument is -1, the current file offset is updated." I am sure vstinner will want to change this description again :)

@@ -5334,6 +5334,7 @@ PyDoc_STRVAR(os_pwritev__doc__,
"\n"
"- RWF_DSYNC\n"
"- RWF_SYNC\n"
"- RWF_APPEND\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must also update posixmodule.c docstring, and then run "make clinic" to regenerate this file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was tried travis-ci seems to fail

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please modify Modules/posixmodule.c and then run "make clinic".

@@ -14023,6 +14023,9 @@ all_ins(PyObject *m)
#ifdef RWF_NOWAIT
if (PyModule_AddIntConstant(m, "RWF_NOWAIT", RWF_NOWAIT)) return -1;
#endif
#ifdef RWF_APPEND
if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1;
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add - RWF_APPEND on line: 9396

@@ -1230,6 +1231,16 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
.. versionadded:: 3.7


.. data:: RWF_APPEND

Append data to the end of the file. See the description of the flag 'O_APPEND' in ''os.open()''.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'O_APPEND' should be written :data:O_APPEND.

''os.open()'' should be written :func:os.open to add a link.

But os.open() doesn't document O_APPEND, just "The above constants are available on Unix and Windows"...

I would prefer to copy preadv Linux manual page:

       RWF_APPEND (since Linux 4.16)
              Provide a per-write equivalent of  the  O_APPEND  open(2)  flag.
              This  flag  is  meaningful  only  for pwritev2(), and its effect
              applies only to the data range written by the system call.   The
              offset argument does not affect the write operation; the data is
              always appended to the end of the file.  However, if the  offset
              argument is -1, the current file offset is updated.

(Adapt it to Python names.)

@@ -0,0 +1 @@
add RWF_APPEND flag
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest:

Add a new :data:`os.RWF_APPEND` flag for :func:`os.pwritev`.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@terryjreedy terryjreedy changed the title bpo-37129: add RWF_APPEND flag bpo-37129: Add os.RWF_APPEND flag for os.pwritev Jun 7, 2019

.. availability:: Linux 4.16 and newer.

.. versionadded:: 3.8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. versionadded:: 3.8
.. versionadded:: 3.9

@terryjreedy
Copy link
Member

The build failure, which I leave to someone else to interpret:
Error in file "./Modules/posixmodule.c" on line 14530:
Checksum mismatch!
Expected: b3ae8afd275ea5cd
Computed: bd017fb8bd0ad675
Suggested fix: remove all generated code including the end marker,
or use the '-f' option.
make: *** [clinic] Error 255

@vstinner
Copy link
Member

vstinner commented Jun 7, 2019

You can use: ./python Tools/clinic/clinic.py Modules/posixmodule.c -f

@vstinner
Copy link
Member

@bezoka: Would you mind to update your PR for my latest comments? (update the doc) This PR can still land into Python 3.8.0, since it only adds a new constant.

@csabella
Copy link
Contributor

I am going to close this PR as abandoned (the original author has not been active in nearly a year). This is available for someone else to make a new PR. Please credit the original author in the commit message.

@csabella csabella closed this May 23, 2020
@terryjreedy
Copy link
Member

I just noticed that the this PR proposes to merge bezoka's cpython master branch rather than an issue branch from master. This being rather fragile, this should have been closed and redone immediately. It should not be reopened even if it could be.

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

Successfully merging this pull request may close these issues.

8 participants