2017-01-03 13:16:48 -08:00
|
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the
|
|
|
|
// "Software"), to deal in the Software without restriction, including
|
|
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
|
|
// following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included
|
|
|
|
// in all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-12-30 18:38:06 -05:00
|
|
|
const common = require('../common');
|
2017-07-01 02:29:09 +03:00
|
|
|
if (!common.isWindows)
|
|
|
|
common.skip('this test is Windows-specific.');
|
|
|
|
|
2016-12-30 18:38:06 -05:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
2011-11-25 09:29:06 +01:00
|
|
|
|
2017-12-24 22:38:11 -08:00
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
|
2019-01-21 01:22:27 +01:00
|
|
|
// Make a path that will be at least 260 chars long.
|
2017-12-24 22:38:11 -08:00
|
|
|
const fileNameLen = Math.max(260 - tmpdir.path.length - 1, 1);
|
2023-08-15 22:45:24 +09:00
|
|
|
const fileName = tmpdir.resolve('x'.repeat(fileNameLen));
|
2017-01-08 13:19:00 +00:00
|
|
|
const fullPath = path.resolve(fileName);
|
2011-11-25 09:29:06 +01:00
|
|
|
|
2017-12-24 22:38:11 -08:00
|
|
|
tmpdir.refresh();
|
2013-03-02 02:43:01 +01:00
|
|
|
|
2012-01-17 19:43:34 +01:00
|
|
|
console.log({
|
|
|
|
filenameLength: fileName.length,
|
|
|
|
fullPathLength: fullPath.length
|
|
|
|
});
|
2011-11-25 09:29:06 +01:00
|
|
|
|
2020-09-06 22:27:07 +02:00
|
|
|
fs.writeFile(fullPath, 'ok', common.mustSucceed(() => {
|
|
|
|
fs.stat(fullPath, common.mustSucceed());
|
2022-09-13 13:48:53 +02:00
|
|
|
|
|
|
|
// Tests https://github.com/nodejs/node/issues/39721
|
|
|
|
fs.realpath.native(fullPath, common.mustSucceed());
|
2023-12-29 04:57:51 +09:00
|
|
|
|
|
|
|
// Tests https://github.com/nodejs/node/issues/51031
|
|
|
|
fs.promises.realpath(fullPath).then(common.mustCall(), common.mustNotCall());
|
2016-07-15 15:43:24 -04:00
|
|
|
}));
|