wimlib
6 years agoFix extract progress when hard links not supported
Eric Biggers [Thu, 22 May 2014 01:53:13 +0000 (20:53 -0500)]
Fix extract progress when hard links not supported

6 years agoMerge branch 'new_extract'
Eric Biggers [Mon, 19 May 2014 17:05:11 +0000 (12:05 -0500)]
Merge branch 'new_extract'

This rewrites much of the extraction code to give more freedom to
extraction backends about how they extract the files.  This has
advantages for all three backends:

UNIX:  Now does a lot fewer path lookups and should exhibit better data
locality.  Final "set timestamps" pass only processes directories, since
nondirectory timestamps are set before that point.

NTFS-3g:  Now completely based on inode numbers; no paths are ever
created, unless a printable path is needed for an error message.  Got rid
of final "set attributes" and "set timestamps" passes, since all
attributes and timestamps are set before that point.

Windows:  Now uses NT paths relative to the target directory, performs
fewer path lookups, extracts encrypted files without individually reading
ranges from the WIM (expensive for ESD files), and a few other changes.
A lot of code previously in the generic file extract.c actually could be
moved here.

Also, there are no longer any temporary files needed.  All three backends
simply write all the instances of each stream at the same time, which is
more efficient.

Still TODO:
- New format for UNIX data
- Add fallbacks for when number of open files gets too high
- Add fallback for huge encrypted files
- If possible add hardlink and symlink modes back, however these
  are pretty useless.

6 years agostreamifier_cb(): Adjust cur_stream_offset even if ->consume_chunk() fails
Eric Biggers [Wed, 21 May 2014 20:09:13 +0000 (15:09 -0500)]
streamifier_cb(): Adjust cur_stream_offset even if ->consume_chunk() fails

This ensures that ->end_stream() gets called.

6 years agodentry.h: Remove unnused declaration of put_dentry()
Eric Biggers [Sun, 18 May 2014 20:49:54 +0000 (15:49 -0500)]
dentry.h: Remove unnused declaration of put_dentry()

6 years agometadata.h: Parenthesize 'imd' argument to macros
Eric Biggers [Sun, 18 May 2014 20:33:53 +0000 (15:33 -0500)]
metadata.h: Parenthesize 'imd' argument to macros

6 years agoDon't set FILE_ATTRIBUTE_SPARSE on Windows
Eric Biggers [Sun, 18 May 2014 05:43:24 +0000 (00:43 -0500)]
Don't set FILE_ATTRIBUTE_SPARSE on Windows

6 years agowinnt_openat(): Use FILE_SHARE_VALID_FLAGS
Eric Biggers [Sun, 18 May 2014 02:54:22 +0000 (21:54 -0500)]
winnt_openat(): Use FILE_SHARE_VALID_FLAGS

No change in meaning, but this is simpler.

6 years agowimextract: For --to-stdout, set stdout to binary mode on Windows
Eric Biggers [Sun, 18 May 2014 02:41:21 +0000 (21:41 -0500)]
wimextract:  For --to-stdout, set stdout to binary mode on Windows

6 years agowin32_common.c: Remove duplicate declaration of func_NtOpenFile
Eric Biggers [Sat, 17 May 2014 06:23:26 +0000 (01:23 -0500)]
win32_common.c: Remove duplicate declaration of func_NtOpenFile

6 years agoinode_fixup.c: Further simplify MS bug workaround
Eric Biggers [Sat, 17 May 2014 06:09:06 +0000 (01:09 -0500)]
inode_fixup.c:  Further simplify MS bug workaround

Based on what WIMGAPI does, and assuming it sufficiently works around its
own [presumably fixed] bug, the workaround can be simplified to just
"don't hard link dentries that have different unnamed data streams".

6 years agoinode_fixup.c: Simplify logic
Eric Biggers [Sat, 17 May 2014 03:08:16 +0000 (22:08 -0500)]
inode_fixup.c:  Simplify logic

Most of the logic in this file is working around a Microsoft bug, but
there must be an easier way to do it.  This commits strips the code down
to something more logical that still seems to "do the right thing" on a
Windows 7 WIM affected by the Microsoft bug.

6 years agodentry.h: Remove declaration of dentry_tree_fix_inodes()
Eric Biggers [Sat, 17 May 2014 02:36:05 +0000 (21:36 -0500)]
dentry.h:  Remove declaration of dentry_tree_fix_inodes()

This is already declared in inode.h.

6 years agowin32_replacements.c: Remove unnecessary 'extern'
Eric Biggers [Fri, 16 May 2014 01:37:50 +0000 (20:37 -0500)]
win32_replacements.c: Remove unnecessary 'extern'

6 years agoRewrite code for capture rpfix
Eric Biggers [Fri, 16 May 2014 01:13:34 +0000 (20:13 -0500)]
Rewrite code for capture rpfix

The previous code had many potential problems on the Windows side.
Targets of Windows native symbolic links (except those with
SYMBOLIC_LINK_RELATIVE set) and junction points are stored in the reparse
points as NT namespace paths.  Therefore they can validly include
prefixes like '\??\', '\DosDevices\', or '\Device\HardDiskVolume1'.  They
potentially do not use drive letters at all, and they may be over
MAX_PATH characters.  Such paths should be accessed using the native API
(NtOpenFile), not Win32 (CreateFile).  This commit changes the code to do
so.

6 years agoreparse.c: Fix volume_junction_prefix
Eric Biggers [Thu, 15 May 2014 17:53:57 +0000 (12:53 -0500)]
reparse.c: Fix volume_junction_prefix

This uses an NT namespace path, so it's \??\ prefix not \\?\.

6 years agoUpdate NEWS
Eric Biggers [Thu, 15 May 2014 17:14:51 +0000 (12:14 -0500)]
Update NEWS

6 years agoRemove unused win32_truncate_replacement()
Eric Biggers [Thu, 15 May 2014 04:50:12 +0000 (23:50 -0500)]
Remove unused win32_truncate_replacement()

6 years agoMove code from win32_common.c to win32_apply.c
Eric Biggers [Thu, 15 May 2014 04:48:17 +0000 (23:48 -0500)]
Move code from win32_common.c to win32_apply.c

6 years agoupdate_image.c: Fix memory leak in error path
Eric Biggers [Thu, 15 May 2014 03:15:59 +0000 (22:15 -0500)]
update_image.c: Fix memory leak in error path

6 years agowin32_replacements.c: Remove unused headers
Eric Biggers [Thu, 15 May 2014 03:11:31 +0000 (22:11 -0500)]
win32_replacements.c: Remove unused headers

6 years agofile_io.h: Remove unused declaration of filedes_copy()
Eric Biggers [Thu, 15 May 2014 03:06:33 +0000 (22:06 -0500)]
file_io.h: Remove unused declaration of filedes_copy()

6 years agofile_io.h: Remove unused declaration of struct iovec
Eric Biggers [Thu, 15 May 2014 03:05:19 +0000 (22:05 -0500)]
file_io.h: Remove unused declaration of struct iovec

6 years agowin32_common.c: Remove unused headers
Eric Biggers [Thu, 15 May 2014 03:00:57 +0000 (22:00 -0500)]
win32_common.c: Remove unused headers

6 years agofile_io.c: Remove unused header sys/uio.h
Eric Biggers [Thu, 15 May 2014 02:59:20 +0000 (21:59 -0500)]
file_io.c: Remove unused header sys/uio.h

6 years agowin32.h: Remove unused stuff
Eric Biggers [Thu, 15 May 2014 02:53:05 +0000 (21:53 -0500)]
win32.h: Remove unused stuff

6 years agowin32_capture.c: Fix format string
Eric Biggers [Thu, 15 May 2014 00:54:40 +0000 (19:54 -0500)]
win32_capture.c: Fix format string

6 years agowin32_apply.c: Call match_pattern_list() from in_prepopulate_list()
Eric Biggers [Thu, 15 May 2014 00:29:10 +0000 (19:29 -0500)]
win32_apply.c: Call match_pattern_list() from in_prepopulate_list()

6 years agowin32_capture.c: Remove unused variable
Eric Biggers [Thu, 15 May 2014 00:28:29 +0000 (19:28 -0500)]
win32_capture.c: Remove unused variable

6 years agoRemove duplicate words & fix grammatical errors
Eric Biggers [Thu, 15 May 2014 00:19:58 +0000 (19:19 -0500)]
Remove duplicate words & fix grammatical errors

6 years agowrite_wim_part(): Distinguish between explicit GUID and retained GUID
Eric Biggers [Wed, 14 May 2014 23:35:37 +0000 (18:35 -0500)]
write_wim_part(): Distinguish between explicit GUID and retained GUID

6 years agoUpdate wimlib-imagex man pages, especially the main one
Eric Biggers [Wed, 14 May 2014 21:02:38 +0000 (16:02 -0500)]
Update wimlib-imagex man pages, especially the main one

6 years agowimlib.h: Update docs for write flags
Eric Biggers [Wed, 14 May 2014 20:46:13 +0000 (15:46 -0500)]
wimlib.h: Update docs for write flags

6 years agowrite.c: Don't default to solid mode quite as easily
Eric Biggers [Wed, 14 May 2014 20:45:42 +0000 (15:45 -0500)]
write.c: Don't default to solid mode quite as easily

6 years agoAdd WIMLIB_WRITE_FLAG_RETAIN_GUID
Eric Biggers [Wed, 14 May 2014 18:37:57 +0000 (13:37 -0500)]
Add WIMLIB_WRITE_FLAG_RETAIN_GUID

... and use it in wimlib_join() and wimlib_overwrite().

Remove the guid_set_explicitly hack.

6 years agowimlib_write(): Update flags debugging statements
Eric Biggers [Wed, 14 May 2014 18:36:19 +0000 (13:36 -0500)]
wimlib_write(): Update flags debugging statements

6 years agoimagex-update.1.in: Update
Eric Biggers [Wed, 14 May 2014 17:57:29 +0000 (12:57 -0500)]
imagex-update.1.in:  Update

6 years agoAdd WIMLIB_EXPORT_FLAG_GIFT
Eric Biggers [Wed, 14 May 2014 06:36:19 +0000 (01:36 -0500)]
Add WIMLIB_EXPORT_FLAG_GIFT

6 years agoreference.c: Don't duplicate stream entries unnecessarily
Eric Biggers [Wed, 14 May 2014 06:16:01 +0000 (01:16 -0500)]
reference.c:  Don't duplicate stream entries unnecessarily

With wimlib_reference_resource_files(), the resource WIMs are never made
accessible to library users, so there is no need to retain copies of all
stream entries in their lookup tables.

6 years agounix_capture.c: Optionally use dirfd-relative functions (openat(), etc)
Eric Biggers [Wed, 14 May 2014 04:37:41 +0000 (23:37 -0500)]
unix_capture.c: Optionally use dirfd-relative functions (openat(), etc)

6 years agowin32_capture.c: More improvements
Eric Biggers [Wed, 14 May 2014 02:51:43 +0000 (21:51 -0500)]
win32_capture.c:  More improvements

6 years agoNTFS-3g capture: Fix setting DOS name
Eric Biggers [Tue, 13 May 2014 23:27:37 +0000 (18:27 -0500)]
NTFS-3g capture: Fix setting DOS name

6 years agowin32_get_security_descriptor(): Check for STATUS_BUFFER_TOO_SMALL
Eric Biggers [Tue, 13 May 2014 23:16:02 +0000 (18:16 -0500)]
win32_get_security_descriptor(): Check for STATUS_BUFFER_TOO_SMALL

6 years agowin32_capture_streams(): Decrease buffer size for stream info
Eric Biggers [Tue, 13 May 2014 23:11:21 +0000 (18:11 -0500)]
win32_capture_streams(): Decrease buffer size for stream info

6 years agowin32_capture.c: Use NtQueryInformationFile() instead of GetFileInformationByHandle()
Eric Biggers [Tue, 13 May 2014 23:07:36 +0000 (18:07 -0500)]
win32_capture.c:  Use NtQueryInformationFile() instead of GetFileInformationByHandle()

6 years agowin32_capture.c: Load volume information on first chance
Eric Biggers [Tue, 13 May 2014 22:41:22 +0000 (17:41 -0500)]
win32_capture.c: Load volume information on first chance

6 years agowin32_capture.c: Fix getting file size
Eric Biggers [Tue, 13 May 2014 22:08:43 +0000 (17:08 -0500)]
win32_capture.c: Fix getting file size

6 years agowin32_capture.c: Use NtOpenFile() and directory-relative paths
Eric Biggers [Tue, 13 May 2014 21:49:44 +0000 (16:49 -0500)]
win32_capture.c:  Use NtOpenFile() and directory-relative paths

6 years agoLoad NtOpenFile() and NtClose()
Eric Biggers [Tue, 13 May 2014 19:58:57 +0000 (14:58 -0500)]
Load NtOpenFile() and NtClose()

6 years agowin32_common.c: Refactor dll loading
Eric Biggers [Tue, 13 May 2014 19:52:23 +0000 (14:52 -0500)]
win32_common.c: Refactor dll loading

6 years agowin32_capture.c: Remove unused code
Eric Biggers [Tue, 13 May 2014 19:19:05 +0000 (14:19 -0500)]
win32_capture.c: Remove unused code

6 years agoWindows: Use ntdll unconditionally
Eric Biggers [Tue, 13 May 2014 18:59:48 +0000 (13:59 -0500)]
Windows: Use ntdll unconditionally

The non-ntdll code isn't being tested, and there are known problems with
it.  For now, just rely on ntdll unconditionally.

6 years agoAdd wrappers around wimlib_update_image()
Eric Biggers [Tue, 13 May 2014 17:45:45 +0000 (12:45 -0500)]
Add wrappers around wimlib_update_image()

* wimlib_add_tree()
* wimlib_rename_path()
* wimlib_delete_path()

6 years agowim.c: Make two functions static
Eric Biggers [Tue, 13 May 2014 17:21:41 +0000 (12:21 -0500)]
wim.c: Make two functions static

6 years agoRemove WIMLIB_OPEN_MASK_PUBLIC
Eric Biggers [Tue, 13 May 2014 17:20:42 +0000 (12:20 -0500)]
Remove WIMLIB_OPEN_MASK_PUBLIC

6 years agowildcard.c: Remove redundant calculation of string length
Eric Biggers [Tue, 13 May 2014 16:24:29 +0000 (11:24 -0500)]
wildcard.c: Remove redundant calculation of string length

6 years agowim_root_dentry() => wim_get_current_root_dentry()
Eric Biggers [Tue, 13 May 2014 16:17:03 +0000 (11:17 -0500)]
wim_root_dentry() => wim_get_current_root_dentry()

Likewise for wim_security_data().

6 years agowimlib_iterate_lookup_table(): Check wim_has_metadata() instead of part 1
Eric Biggers [Tue, 13 May 2014 16:07:56 +0000 (11:07 -0500)]
wimlib_iterate_lookup_table(): Check wim_has_metadata() instead of part 1

6 years agofree_lookup_table(): Simplify
Eric Biggers [Tue, 13 May 2014 15:49:56 +0000 (10:49 -0500)]
free_lookup_table(): Simplify

6 years agounix_capture_symlink(): De-indent
Eric Biggers [Tue, 13 May 2014 15:36:06 +0000 (10:36 -0500)]
unix_capture_symlink(): De-indent

6 years agoRemove printf extension
Eric Biggers [Tue, 13 May 2014 07:47:21 +0000 (02:47 -0500)]
Remove printf extension

Only one place used %WS to print an UTF-16LE string.  Get rid of it.

6 years agowimlib_malloc(): Only malloc(1) if NULL is returned
Eric Biggers [Tue, 13 May 2014 07:38:17 +0000 (02:38 -0500)]
wimlib_malloc(): Only malloc(1) if NULL is returned

6 years agoread_wim_security_data(): Fix comment, make prototype consistent
Eric Biggers [Tue, 13 May 2014 07:14:59 +0000 (02:14 -0500)]
read_wim_security_data(): Fix comment, make prototype consistent

6 years agoprepare_metadata_resource(): Check for size overflow
Eric Biggers [Tue, 13 May 2014 07:00:29 +0000 (02:00 -0500)]
prepare_metadata_resource(): Check for size overflow

6 years agodentry_tree_fix_inodes(): Fix comment
Eric Biggers [Tue, 13 May 2014 06:46:58 +0000 (01:46 -0500)]
dentry_tree_fix_inodes(): Fix comment

6 years agoref_inodes_consistent(): Remove useless use of restrict
Eric Biggers [Tue, 13 May 2014 06:37:39 +0000 (01:37 -0500)]
ref_inodes_consistent(): Remove useless use of restrict

6 years agofix_inodes(): Use size_t for iterator
Eric Biggers [Tue, 13 May 2014 06:26:48 +0000 (01:26 -0500)]
fix_inodes(): Use size_t for iterator

6 years agoinode_set_unnamed_stream(): inode must be resolved
Eric Biggers [Tue, 13 May 2014 06:03:36 +0000 (01:03 -0500)]
inode_set_unnamed_stream(): inode must be resolved

6 years agoFix checks for huge numbers of images
Eric Biggers [Tue, 13 May 2014 05:50:17 +0000 (00:50 -0500)]
Fix checks for huge numbers of images

6 years agoReplace WIM_GID_LEN => WIM_GUID_LEN
Eric Biggers [Tue, 13 May 2014 05:44:46 +0000 (00:44 -0500)]
Replace WIM_GID_LEN => WIM_GUID_LEN

6 years agoread_wim_header(): Fix comment
Eric Biggers [Tue, 13 May 2014 05:41:24 +0000 (00:41 -0500)]
read_wim_header(): Fix comment

6 years agoImprove tstr <=> UTF-16LE conversions
Eric Biggers [Tue, 13 May 2014 05:25:50 +0000 (00:25 -0500)]
Improve tstr <=> UTF-16LE conversions

Consolidated conditional code into encoding.h.
A few related cleanups.

6 years agoinode_get_ads_entry(): de-indent
Eric Biggers [Tue, 13 May 2014 01:31:46 +0000 (20:31 -0500)]
inode_get_ads_entry(): de-indent

6 years agowrite_dentry(): Remove unhelpful comment
Eric Biggers [Tue, 13 May 2014 01:22:41 +0000 (20:22 -0500)]
write_dentry(): Remove unhelpful comment

6 years agoRemove dentry_get_file_type_string()
Eric Biggers [Tue, 13 May 2014 01:13:22 +0000 (20:13 -0500)]
Remove dentry_get_file_type_string()

6 years agoread_dentry(): Remove warning about dentry being unaligned
Eric Biggers [Tue, 13 May 2014 01:05:26 +0000 (20:05 -0500)]
read_dentry():  Remove warning about dentry being unaligned

The code should still work anyway, and the message isn't particularly
helpful.

6 years agofree_dentry_tree(): Check lookup_table only once per call
Eric Biggers [Tue, 13 May 2014 00:56:13 +0000 (19:56 -0500)]
free_dentry_tree(): Check lookup_table only once per call

6 years agoFactor out inode_unref_streams()
Eric Biggers [Tue, 13 May 2014 00:47:56 +0000 (19:47 -0500)]
Factor out inode_unref_streams()

6 years agonew_filler_directory(): Remove 'name' argument
Eric Biggers [Tue, 13 May 2014 00:21:55 +0000 (19:21 -0500)]
new_filler_directory(): Remove 'name' argument

6 years agodentry.c: Remove dentry_common_init()
Eric Biggers [Tue, 13 May 2014 00:17:06 +0000 (19:17 -0500)]
dentry.c: Remove dentry_common_init()

6 years agowim_pathname_to_stream(): Remove unnecessary goto and label
Eric Biggers [Tue, 13 May 2014 00:16:16 +0000 (19:16 -0500)]
wim_pathname_to_stream(): Remove unnecessary goto and label

6 years agodentry.c: Remove calculate_dentry_tree_full_paths()
Eric Biggers [Mon, 12 May 2014 23:18:21 +0000 (18:18 -0500)]
dentry.c:  Remove calculate_dentry_tree_full_paths()

6 years agofile_io.c: Remove unused full_writev()
Eric Biggers [Mon, 12 May 2014 22:46:48 +0000 (17:46 -0500)]
file_io.c:  Remove unused full_writev()

6 years agochunk compressor: Use u32, not unsigned, for chunk sizes
Eric Biggers [Mon, 12 May 2014 22:22:20 +0000 (17:22 -0500)]
chunk compressor: Use u32, not unsigned, for chunk sizes

6 years agocapture_common.c: Cleanup (mostly comments)
Eric Biggers [Mon, 12 May 2014 21:58:21 +0000 (16:58 -0500)]
capture_common.c:  Cleanup (mostly comments)

6 years agoadd_image.c: Cleanup
Eric Biggers [Mon, 12 May 2014 20:19:43 +0000 (15:19 -0500)]
add_image.c:  Cleanup

Including:

- Use wimlib/security.h instead of wimlib/capture.h
- Replace add_new_dentry_tree() with add_empty_image_metadata()
  (the root dentry is always NULL)
- Improve comments

6 years agowincfg: Add swapfile.sys
Eric Biggers [Mon, 12 May 2014 19:55:21 +0000 (14:55 -0500)]
wincfg:  Add swapfile.sys

6 years agowimlib.h: Update add flag documentation
Eric Biggers [Mon, 12 May 2014 19:52:07 +0000 (14:52 -0500)]
wimlib.h: Update add flag documentation

6 years agoupdate_image.c: Check for unsupported NTFS mode earlier
Eric Biggers [Mon, 12 May 2014 19:45:03 +0000 (14:45 -0500)]
update_image.c:  Check for unsupported NTFS mode earlier

6 years agoDon't create unnecessary temporary files
Eric Biggers [Sun, 11 May 2014 05:23:34 +0000 (00:23 -0500)]
Don't create unnecessary temporary files

A temporary file is unnecessary (without too much extra trouble) if the
whole stream data is already in memory as a result of reading a packed
resource.

6 years agocreate_temporary_file(): use _O_SHORT_LIVED on Windows
Eric Biggers [Sun, 11 May 2014 05:23:27 +0000 (00:23 -0500)]
create_temporary_file(): use _O_SHORT_LIVED on Windows

6 years agowin32_extract_stream(): Pre-allocate stream length
Eric Biggers [Sun, 11 May 2014 05:22:26 +0000 (00:22 -0500)]
win32_extract_stream():  Pre-allocate stream length

6 years agowimcapture, wimexport: With --pack-streams, default to LZMS compression
Eric Biggers [Sat, 10 May 2014 02:56:22 +0000 (21:56 -0500)]
wimcapture, wimexport:  With --pack-streams, default to LZMS compression

This is not too important as the compression format of packed resources
is independent of the WIM's main compression format, but it makes sense
to also default to LZMS for non-packed resources (e.g. metadata).

6 years agoupdate_image.c: Avoid unnecessary string duplications
Eric Biggers [Fri, 9 May 2014 16:07:57 +0000 (11:07 -0500)]
update_image.c: Avoid unnecessary string duplications

6 years agoRemove canonicalize_fs_path()
Eric Biggers [Fri, 9 May 2014 15:16:10 +0000 (10:16 -0500)]
Remove canonicalize_fs_path()

6 years agoimagex-extract.1.in: Note that ASCII pathlist is fine
Eric Biggers [Fri, 9 May 2014 15:07:28 +0000 (10:07 -0500)]
imagex-extract.1.in:  Note that ASCII pathlist is fine

6 years agowimlib-imagex: Accept "max" as alias for "maximum"
Eric Biggers [Fri, 9 May 2014 04:14:10 +0000 (23:14 -0500)]
wimlib-imagex: Accept "max" as alias for "maximum"

6 years agoUpdate NEWS
Eric Biggers [Fri, 9 May 2014 03:26:01 +0000 (22:26 -0500)]
Update NEWS

6 years agoUpdate version number in preparation of eventual v1.6.3 release
Eric Biggers [Fri, 9 May 2014 03:23:56 +0000 (22:23 -0500)]
Update version number in preparation of eventual v1.6.3 release

6 years agoAllow writing multiple packed resources per WIM
Eric Biggers [Fri, 9 May 2014 01:46:18 +0000 (20:46 -0500)]
Allow writing multiple packed resources per WIM

... subject to the weird way that WIMGAPI interprets them.

Also:
    - Write packed resource by default when updating version 3584 WIM
    - Enable raw copy of packed resources (must be writing at least 2/3
      the constituent streams)

6 years agoread_wim_lookup_table(): Allow multiple "subpacks" per packed run
Eric Biggers [Fri, 9 May 2014 00:54:01 +0000 (19:54 -0500)]
read_wim_lookup_table():  Allow multiple "subpacks" per packed run

Apparently WIMGAPI does, in fact, support multiple packed resources per
WIM.  It creates them when exporting, and probably when appending too.
However, the format of the resulting lookup table is a little different
than I had expected, since it seems to be required that all the packed
resource metadata be combined into a single, mostly unordered run of
entries with the 0x10 flag set.  This commit updates the read-side code
with this new assumption.