mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
6db8db6dfd
Summary: The unix `patch` command attempts to issue an `FS_IOC_GETFLAGS` ioctl and blows up when we return `ENOSYS`. The man page for ioctl says: ``` ENOTTY The specified request does not apply to the kind of object that the file descriptor fd references. ``` so let's return that error code to ioctl. In addition, the integration test I added for this trips up when it calls `llistxattr` on the file; turns out we don't need to insert the `fuse_getxattr_out` when we're returning the attribute list and that it is only needed when measuring up the required length, so let's move things around to resolve this and make it clearer. Reviewed By: chadaustin Differential Revision: D6685568 fbshipit-source-id: 81963ffe9af30db5634e5e96b7a8aa1485859d65
38 lines
991 B
Python
38 lines
991 B
Python
#!/usr/bin/env python3
|
|
#
|
|
# Copyright (c) 2016-present, Facebook, Inc.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the BSD-style license found in the
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
from .lib import testcase
|
|
import os
|
|
import subprocess
|
|
|
|
|
|
@testcase.eden_repo_test
|
|
class PatchTest:
|
|
def populate_repo(self):
|
|
self.repo.write_file('hello', 'hola\n')
|
|
self.repo.commit('Initial commit.')
|
|
|
|
def edenfs_logging_settings(self):
|
|
return {'eden.strace': 'DBG7', 'eden.fs.fuse': 'DBG7'}
|
|
|
|
def test_patch(self):
|
|
proc = subprocess.Popen(['patch'], cwd=self.mount, stdin=subprocess.PIPE)
|
|
stdout, stderr = proc.communicate(b'''
|
|
--- hello
|
|
+++ hello
|
|
@@ -1 +1 @@
|
|
-hola
|
|
+bye
|
|
''')
|
|
|
|
print(stdout, stderr)
|
|
|
|
with open(os.path.join(self.mount, 'hello'), 'r') as f:
|
|
self.assertEqual('bye\n', f.read())
|